php – 向管理员发送暂停订单状态电子邮件通知
发布时间:2020-12-13 16:08:48 所属栏目:PHP教程 来源:网络整理
导读:我希望管理员在WooCommerce中收到暂停订单通知.现在,只有客户才能收到通知. 我尝试了以下代码,但它似乎不起作用. 这是我的代码: add_filter( 'woocommerce_email_headers','mycustom_headers_filter_function',10,2);function mycustom_headers_filter_func
我希望管理员在WooCommerce中收到暂停订单通知.现在,只有客户才能收到通知.
我尝试了以下代码,但它似乎不起作用. 这是我的代码: 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>' . "rn"; } return $headers; } 什么应该使用正确的过滤器/钩子? 谢谢 解决方法
“on-hold”订单状态电子邮件通知的正确$email_id是’customer_on-hold_order’.
所以你的代码将是: add_filter( 'woocommerce_email_headers','custom_admin_email_notification',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>rn'; } return $headers; } 代码放在活动子主题(或主题)的function.php文件中,或者放在任何插件文件中. 代码经过测试和运行. 相似的答案:How to get order ID in woocommerce_email_headers hook (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |