Hi,
It should fire the e-mail after the user has clicked the ‘pay offline’ button (immediately after updating the booking to ‘pending’). In theory, there could be an error in updating the booking status from ‘incomplete’ to ‘pending’, but the email would still be sent; however I cannot see why there would occur.
If you’re only offering offline payment, then you can skip the payment screen step with:
add_filter('eventorganiser_booking_skip_payment_options', '__return_true');
However, I think doing that will result in the booking remaining ‘incomplete’. You can mark the booking automatically as pending via:
add_action('eventorganiser_transition_booking_status', function($new_status, $old_status, $booking){
if($old_status === "new" && $new_status === "incomplete") {
eo_set_booking_status($booking->ID, 'pending');
// Note, this will not send the email
}
}, 10, 3);
Note that the offline payment instructions are sent when the user indicates they are going to pay offline, so the above won’t automatically send the offline email. For that you would need to to the following instead:
add_action('eventorganiser_transition_booking_status', function($new_status, $old_status, $booking){
if($old_status === "new" && $new_status === "incomplete") {
eo_set_booking_status($booking->ID, 'pending');
if ( eventorganiser_pro_get_option( 'offline_email' ) ) {
// Get email details
$template = eventorganiser_pro_get_option( 'email_template' );
$from_name = get_bloginfo( 'name' );
$from_email = eo_get_admin_email( $booking->ID );
$bookee_email = eo_get_booking_meta( $booking->ID, 'bookee_email' );
// Get messgage & subject from the options
$message = eventorganiser_email_template_tags( eventorganiser_pro_get_option( 'offline_email_message' ), $booking->ID, $template );
$message = wpautop( $message );
$subject = eventorganiser_pro_get_option( 'offline_email_subject' );
$subject = wp_specialchars_decode( $subject, ENT_QUOTES );
//Set headers
$headers = array(
'from:' . stripslashes_deep( html_entity_decode( $from_name, ENT_COMPAT, 'UTF-8' ) ) . " <$from_email>",
'reply-to:' . $from_email
);
eventorganiser_mail( $bookee_email, $subject, $message, $headers, array(), $template );
}
}
}, 10, 3);