在所有Woocommerce电子邮件通知中更改“回复”电子邮件地址

时间:2019-03-19 12:14:10

标签: php wordpress woocommerce hook-woocommerce email-notifications

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

Woocommerce这怎么可能?

1 个答案:

答案 0 :(得分:2)

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

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文件中。经过测试,可以正常工作。

相关:Custom "reply to" email header in Woocommerce New Order email notification

相关问题