I want to notify both user and admin through an email when user made a booking in WooCommerce Bookings. Now it is sending mail only to admin to confirm booking.
Can anyone give me right direction, as how to achieve this. Thanks.
I want to notify both user and admin through an email when user made a booking in WooCommerce Bookings. Now it is sending mail only to admin to confirm booking.
Can anyone give me right direction, as how to achieve this. Thanks.
It's a piece of cake.
function my_awesome_shipping_notification($order_id, $checkout = null) {
global $woocommerce;
$order = new WC_Order($order_id);
if ($order->status === 'on-hold') {
// Create a mailer
$mailer = $woocommerce->mailer();
$message_body = __('Order placed: Waiting for confirmation.', 'text_domain');
$message = $mailer->wrap_message(
// Message head and message body.
sprintf(__('Order %s ready for shipping', 'text_domain'), $order->get_order_number()), $message_body);
// Client email, email subject and message.
$result = $mailer->send($order->billing_email, sprintf(__('Order %s received', 'text_domain'), $order->get_order_number()), $message);
//error_log( $result );
}
}
add_action('woocommerce_order_status_changed', 'my_awesome_shipping_notification');
Hope this helps.
Reference: [https://docs.woocommerce.com/document/bookings-action-and-filter-reference/][1]
read the plugin documentation!
WooCommerce Bookings has five email alerts that are handled for you automatically. You can edit all emails sent to customers at: WooCommerce > Settings > Emails. They are: