[英]Change WooCommerce processing order email notification recipient to a custom address
When the order status in WooCommerce is set from pending to processing I can send an email to my customer. 当WooCommerce中的订单状态从待 处理设置为处理时,我可以向客户发送电子邮件。 But I need to send an email only to a custom email adresse instead of the customer default address. 但是我只需要发送一封电子邮件到自定义电子邮件地址,而不是客户的默认地址。
Is there a hook or filter for the functions.php
file? 是否有钩子或过滤器的functions.php
文件?
This custom function hooked in woocommerce_email_recipient_customer_processing_order
filter hook, will do the job (Set in it your replacement email) : 挂在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 ) {
if ( ! is_a( $order, 'WC_Order' ) ) return $recipient;
// Set HERE your replacement recipient email(s)… (If multiple, separate them by a coma)
$recipient = 'name@example.com';
return $recipient;
}
Code goes in function.php file of your active child theme (or theme) or also in any plugin file. 代码在您的活动子主题(或主题)的function.php文件中,或者在任何插件文件中。
Tested and works 经过测试和工作
To add the custom recipient to the customer email, you should use this instead (if needed) : 要将自定义收件人添加到客户电子邮件中,请改用此(如果需要) :
$recipient .= ',name@example.com';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.