php - 在所有 Woocommerce 电子邮件通知中更改“回复”电子邮件地址
问题描述
在 Woocommerce 中,我想更改应始终用作所有电子邮件通知的回复地址的电子邮件地址。
Woocommerce 怎么可能做到这一点?
解决方案
以下将更改所有电子邮件通知中的“回复”电子邮件地址(和名称):
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)。
相关:Woocommerce 新订单电子邮件通知中的自定义“回复”电子邮件标题
注意(更新):从 WooCommerce 3.7 开始,WC_Email
实例对象现在作为第 4 个参数包含在挂钩中。
推荐阅读
- excel - Excel 根据下拉菜单跳转到特定列/单元格
- python - 熊猫数据框放大
- django - ManyToManyRelation 中的 Django models.CASCADE
- python - Python:字符串连接
- compiler-construction - 我怎样才能使它能够用 LALR(1) 解决
- r - 为什么 XPath 中的“link”比“//link”快?
- powerbi - Power BI 表磁贴缺少行。我该如何预防?
- list - kotlin 中的集合现在可以正常工作
- google-play - Play 商店 2020:是否有将应用从封闭测试“推广”到生产的审核流程?
- android - 从受信任的 Web 活动 (TWA) 启动另一个活动