Hello,
You can do this:
In Easy Booking > Settings > Booking statuses, set “Keep start status for” to “1” (so Start status is set 1 day before start date).
Then, add the following code to your theme’s functions.php:
add_action( 'wceb_order_item_status_start', 'wceb_send_email', 10, 1 );
function wceb_send_email( $item_id ) {
$order_item = WC_Order_Factory::get_order_item( $item_id );
$order_id = $order_item->get_order_id();
$order = wc_get_order( $order_id );
$order->add_order_note( 'Your booking starts tomorrow', 1 );
}
Note that this will be sent for each order item. You can send only one email per order using this code instead:
add_action( 'wceb_order_booking_status_changed', 'wceb_send_email_notification', 10, 2 );
function wceb_send_email_notification( $order_id, $item_statuses ) {
if ( array_key_exists( 'wceb-start', $item_statuses ) ) {
$order = wc_get_order( $order_id );
$order->add_order_note( 'Your bookings start tomorrow.', 1 );
}
}
Now please note that this could not work 100%. I invite you to read this article where I explain how it works and why it’s not perfect (“Email notifications” at the end).
I hope this helps ??
Regards,
Natasha