3

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.

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
vinit
  • 115
  • 1
  • 2
  • 13
  • I'll suggest you to contact Plugin Author for this, as it is a paid plugin so they will provide you the good support. Or else you can check this [Email Notifications](https://docs.woocommerce.com/document/the-customer-booking-process/#section-3). – Raunak Gupta Oct 06 '16 at 08:59

2 Answers2

0

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]

Kapil Yadav
  • 650
  • 1
  • 5
  • 29
0

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:

  1. New Booking: Emails are sent to the admin when a new booking is created.
  2. Booking Confirmed: Emails are sent when a booking is confirmed.
  3. Booking Reminder: Emails are sent to the customer one day prior to their booking to remind them of an upcoming booking.
  4. Booking Notification: Notification emails are sent manually from WooCommerce > Bookings > Send Notification.
  5. Booking Cancelled: Emails are sent when a booking is cancelled.

source

Drivingralle
  • 33
  • 1
  • 8
Yahya Hussein
  • 8,767
  • 15
  • 58
  • 114