在 Woocommerce 中作为密件抄送发送给管理员的新帐户电子邮件通知 [英] New Account Email Notification sent to Admin as BCC in Woocommerce

查看:67
本文介绍了在 Woocommerce 中作为密件抄送发送给管理员的新帐户电子邮件通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的 Woocommerce 商店禁用了价格,我们必须手动批准帐户,然后他们才能看到产品价格.当客户使用 WooCommerce 注册页面注册时,可以使用设置 > 电子邮件中的新帐户"选项向他们发送电子邮件,这很好,但我们想知道客户何时注册,以便我们批准该帐户.

Our Woocommerce shop has prices disabled and we have to manually approve accounts before they can see product prices. When customers register using the WooCommerce registration page they can be sent a email using the "new account" option in the settings > emails which is great but we would like to know when a customer has registered so we can approve the account.

站点管理员如何以密件抄送形式获得此电子邮件的副本?或在客户注册时收到提醒.

How can the site admin get a copy of this email as a BCC ? or be alerted when the customer has registered.

我们过去一直在使用通知插件,但现在由于 WC 核心的更改而停止工作.

We have been using a notification plugin in the past but this has now stopped working due to changes to the WC core.

感谢任何帮助.

推荐答案

要将 Wordpress 管理员电子邮件添加为新帐户通知的密件抄送收件人:

To add the Wordpress admin email as BCC recipient for New account notification:

add_filter( 'woocommerce_email_headers', 'customer_new_account_admin_notification', 20, 3 );
function customer_new_account_admin_notification( $header, $email_id, $order ) {
    // Only for "Customer new account" notification
    if( 'customer_new_account' == $email_id ) {
        // Get admin email
        $admin_email = get_option('admin_email');

        // Set the email as BCC
        $header .= 'Bcc: ' . $admin_email . "\r\n";
    }
    return $header;
}

代码位于活动子主题(或活动主题)的 function.php 文件中.经过测试和工作.

Code goes in function.php file of your active child theme (or active theme). Tested and work.

这篇关于在 Woocommerce 中作为密件抄送发送给管理员的新帐户电子邮件通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆