简体   繁体   English

将WooCommerce处理订单电子邮件通知收件人更改为自定义地址

[英]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.

相关问题 向 WooCommerce 中的其他隐藏收件人发送处理电子邮件通知 - Send processing email notification to an additional hidden recipient in WooCommerce Woocommerce电子邮件通知收件人有条件地基于自定义字段 - Woocommerce email notification recipient conditionally based on custom field 为 WooCommerce 中的特定产品属性添加自定义 email 订单收件人? - Adding a custom email order recipient for specific product attributes in WooCommerce? 在 Woocommerce 中根据客户处理订单电子邮件通知有条件地添加帐户电子邮件 - Add account email conditionally on Customer processing Order email notification in Woocommerce 在 WooCommerce 客户处理订单电子邮件通知中根据付款方式添加自定义消息 - Add custom message according to payment method in WooCommerce customer processing order email notification 客户处理订单电子邮件通知中的 Woocommerce 订单日期时间 - Woocommerce order date-time in customer processing order email notification 从 WooCommerce 处理订单 email 通知中删除订单详细信息 - Remove order details from WooCommerce processing order email notification WooCommerce 中新订单电子邮件通知的自定义主题 - Custom subject for New Order Email notification in WooCommerce 发送有关保留的Woocommerce订单的客户处理订单电子邮件通知 - Send customer processing order email notification for on-hold Woocommerce orders 将回复 email 地址更改为特定 WooCommerce email 通知 - Change reply-to email address to specific WooCommerce email notification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM