Send email notification of sending status

I want the administrator to receive an order notification in standby mode , as well as in WooCommerce. Right now, only customers receive this notification.

I tried the following codes, but it does not work.

Here is my code:

add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);
function mycustom_headers_filter_function( $headers, $object ) {
    if ($object == 'customer_on_hold_order') {
        $headers .= 'BCC: My name <my@email.com>' . "\r\n";
    }
    return $headers;
}

What should be the right filter / hook?

thank

+4
source share
1 answer

The right for "on-hold" notification of order status . $email_id 'customer_on-hold_order'

So your code will be:

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

    if( 'customer_on-hold_order' == $email_id ){
        // Set HERE the Admin email
        $headers .= 'Bcc: My name <my@email.com>\r\n';
    }
    return $headers;
}

The code goes in the function.php file of your active child theme (or theme), as well as in any plug-in file.

.


: woocommerce_email_headers hook

+1

Source: https://habr.com/ru/post/1668150/


All Articles