Send on-hold order status email notification to admin

前端 未结 2 1161
逝去的感伤
逝去的感伤 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:19

    It has been 3 years and the WooCommerce states seem to have changed. I tried using the new states customer_on-hold_order => pending_to_on-hold or woocommerce_order_status_pending_to_on-hold, but no emails came and the headers were not changed. so I resulted in just using single words for the check:

    // Send on-hold order status email notification to admin
    add_filter( 'woocommerce_email_headers', 'custom_admin_email_notification', 10, 3);
    function custom_admin_email_notification( $headers, $email_id, $order ) {
    
        if( strpos($email_id,'hold') > 0 ){
            $headers .= 'Bcc: Admin User '. "\r\n";
        }
        return $headers;
    }
    

    I thank you @LoicTheAztec, however for pointing me in the right direction.

提交回复
热议问题