将woocommerce电子邮件发送到用户电子邮件而不是计费电子邮件 [英] Send woocommerce emails to user email not to billing email
问题描述
我想将电子邮件发送到用户帐户电子邮件,而不是 WooCommerce 中的计费电子邮件.
I want to send e-mails to user account email and not to billing email in WooCommerce.
我只找到了那个代码,但我认为这已经过时了,而且我也不想只向客户用户电子邮件发送 2 封邮件.
I only found that code but I think this is outdated and I also don't want to send 2 mails only one to customer user email.
代码在这里:
https://www.webdesign101.net/send-e-mails-user-account-email-billing-email-woocommerce/
尝试过此代码但已过时,而且还有 2 封邮件,而不是一封发送至用户电子邮件的邮件.
Tried this code but outdated and also 2 mails instead of one going to user email.
而且我没有在 woocommerce/templates/email 中找到将标题从 billing_email
更改为 user_email
的行.
And I didn't found the line in woocommerce/templates/email to change the header from billing_email
to user_email
.
我希望 将电子邮件从 WooCommerce 发送到用户电子邮件,而不是帐单电子邮件.
推荐答案
function wc_change_new_order_email_recipient($recipient, $order) {
global $woocommerce;
$user = $order->get_user();
$recipient[] = $user->user_email;
return $recipient;
}
add_filter('woocommerce_email_recipient_new_order', 'wc_change_new_order_email_recipient', 10, 2);
这篇关于将woocommerce电子邮件发送到用户电子邮件而不是计费电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!