将WooCommerce处理订单电子邮件通知收件人更改为自定义地址
问题描述:
当WooCommerce的订单状态设置为待定至处理我可以发送电子邮件给我的客户。但我需要发送一封电子邮件到自定义电子邮件地址,而不是客户默认地址。将WooCommerce处理订单电子邮件通知收件人更改为自定义地址
functions.php
文件是否存在挂钩或过滤器?
答
在woocommerce_email_recipient_customer_processing_order
过滤钩子钩住这个自定义函数,将做的工作(设置在它的替代电子邮件):
add_filter('woocommerce_email_recipient_customer_processing_order', 'processing_order_replacement_email_recipient', 10, 2);
function processing_order_replacement_email_recipient($recipient, $order) {
// Set HERE your replacement recipient email(s)… (If multiple, separate them by a coma)
$recipient = '[email protected]';
return $recipient;
}
代码放在你的积极的function.php文件儿童主题(或主题)或任何插件文件。
测试和工程
要添加自定义收件人到客户的电子邮件,你应该使用这个代替(如果需要):
$recipient .= ',[email protected]';