更改为“回复"所有Woocommerce电子邮件通知中的电子邮件地址 [英] Change "reply to" email address in all Woocommerce emails notifications

查看:101
本文介绍了更改为“回复"所有Woocommerce电子邮件通知中的电子邮件地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Woocommerce中,我想更改应始终用作所有电子邮件通知的回复地址的电子邮件地址.

In Woocommerce, I would like to change the email address that should always be used as the reply address for all emails notifications.

Woocommerce这怎么可能?

How is this possible with Woocommerce?

推荐答案

以下内容将更改所有电子邮件通知中的答复"电子邮件地址(和名称):

The following will change the "Reply to" email address (and name) in all email notifications:

add_filter( 'woocommerce_email_headers', 'change_reply_to_email_address', 10, 3 );
function change_reply_to_email_address( $header, $email_id, $order ) {

    // HERE below set the name and the email address
    $reply_to_name  = 'Jack Smith';
    $reply_to_email = 'jack.smith@doamin.tld';

    // Get the WC_Email instance Object
    $email = new WC_Email($email_id);

    $header  = "Content-Type: " . $email->get_content_type() . "\r\n";
    $header .= 'Reply-to: ' . $reply_to_name . ' <' . $reply_to_email . ">\r\n";

    return $header;
}

此代码位于您的活动子主题(或主题)的function.php文件中.经过测试并可以正常工作(感谢 helgatheviking ).

This code goes on function.php file of your active child theme (or theme). Tested and works (Thanks to helgatheviking).

相关:自定义回复" Woocommerce新订单电子邮件通知中的电子邮件标题

注意(更新):自WooCommerce 3.7以来,WC_Email实例对象现在作为第4个参数包含在挂钩中.

Note (update): Since WooCommerce 3.7, the WC_Email instance Object is now included in the hook as 4th argument.

这篇关于更改为“回复"所有Woocommerce电子邮件通知中的电子邮件地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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