Send on-hold order status email notification to admin

前端 未结 2 1173
逝去的感伤
逝去的感伤 2021-01-13 21:41

I want the admin to receive on hold order notification as well in WooCommerce. Right now, only customers get that notification.

I have tried the fol

2条回答
  •  独厮守ぢ
    2021-01-13 22:10

    The correct $email_id for "on-hold" order status email notification is 'customer_on-hold_order'.

    So your code is going to 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 \r\n';
        }
        return $headers;
    }
    

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

    Code is tested and works.


    Similar answers: How to get order ID in woocommerce_email_headers hook

提交回复
热议问题