【问题标题】:Send woocommerce emails to user email not to billing email将woocommerce电子邮件发送到用户电子邮件而不是计费电子邮件
【发布时间】:2019-07-04 20:30:01
【问题描述】:

我想将电子邮件发送到用户帐户电子邮件,而不是 WooCommerce 中的计费电子邮件。

我只找到了该代码,但我认为这已经过时了,我也不想只向客户用户电子邮件发送 2 封邮件。

代码在这里:

https://www.webdesign101.net/send-e-mails-user-account-email-billing-email-woocommerce/

尝试了此代码,但已过时,还有 2 封邮件而不是一封发送到用户电子邮件的邮件。

我没有在 woocommerce/templates/email 中找到将标头从 billing_email 更改为 user_email 的行。

我希望将电子邮件从 WooCommerce 发送到用户电子邮件而不是计费电子邮件

【问题讨论】:

    标签: wordpress woocommerce


    【解决方案1】:
    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);
    

    【讨论】:

    • 非常感谢,我会测试它;)
    • 嗨,我将代码复制到我的 childtheme 的 functions.php 中,但现在根本没有电子邮件通过。
    猜你喜欢
    • 2020-09-03
    • 1970-01-01
    • 2012-07-02
    • 2021-11-06
    • 2012-11-11
    • 2018-05-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多