2

In WooCommerce, I would like to have in "on hold" email notifications, 2 additional emails addresses (pref. bcc), so that they can be monitored for payment.

It is for any orders using BACS so that the relevant people can be notified to keep an eye on thing. I can find all sorts on order complete but not on hold email.

Any help would be much appreciated.

Thanks

LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399
mischiefbec
  • 51
  • 1
  • 8

1 Answers1

2

Is possible using a custom function hooked in woocommerce_email_headers filter hook, this way:

add_filter( 'woocommerce_email_headers', 'custom_admin_email_notification', 10, 3);
function custom_admin_email_notification( $headers, $email_id, $order ) {

    // Targeting "on hold" order status only with BACS payments
    if( 'customer_on-hold_order' == $email_id && 'bacs' == get_post_meta($order->id, '_payment_method', true) ){
        // Set HERE your additionals emails in this array:
        $emails = array('Name1 <name1@email.com>', 'Name2 <name2@email.com>');

        // Adding the new emails to 'Bcc' headers
        $headers .= 'Bcc: '.implode(',', $emails).'\r\n';
    }
    return $headers;
}

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.


Related answers:

Community
  • 1
  • 1
LoicTheAztec
  • 229,944
  • 23
  • 356
  • 399