我正在尝试在订单取消时向客户发送电子邮件 . 默认情况下,woocommerce仅将此电子邮件仅发送给网站的管理员 . 此代码解决了网络上相关帖子的问题:
function wc_cancelled_order_add_customer_email( $recipient, $order ){
return $recipient . ',' . $order->billing_email;
}
add_filter( 'woocommerce_email_recipient_cancelled_order', 'wc_cancelled_order_add_customer_email', 10, 2 );
add_filter( 'woocommerce_email_recipient_failed_order', 'wc_cancelled_order_add_customer_email', 10, 2 );
然而,似乎woocommerce完全删除了那些过滤器钩子 . 有没有办法做到这一点?
提前致谢!
1 回答
在这个挂钩 woocommerce_order_status_changed 动作钩子的自定义函数中,我的目标是"cancelled"和"failed"订单向客户发送相应的电子邮件通知(管理员将通过WooCommerce自动通知接收它):
代码放在活动子主题(或主题)的function.php文件中,或者放在任何插件文件中 .
这应该适用于WooCommerce 3
相关回答:Send an email notification when order status change from pending to cancelled