向管理员发送暂停订单状态电子邮件通知 [英] Send on-hold order status email notification to admin
本文介绍了向管理员发送暂停订单状态电子邮件通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望管理员在 WooCommerce 中也能收到暂停订单通知.目前,只有客户会收到该通知.
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 following codes but it doesn't seem to work.
这是我的代码:
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 correct filter/hook to use?
谢谢
推荐答案
"on-hold" 订单状态的正确$email_id
电子邮件通知为 'customer_on-hold_order'
.
The correct $email_id
for "on-hold" order status email notification is 'customer_on-hold_order'
.
所以你的代码将是:
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;
}
代码位于活动子主题(或主题)的 function.php 文件或任何插件文件中.
代码已经过测试并且有效.
Code is tested and works.
类似答案:如何在 woocommerce_email_headers 挂钩中获取订单 ID
这篇关于向管理员发送暂停订单状态电子邮件通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文