Change “reply to” email address in all Woocommerce emails notifications

独自空忆成欢 提交于 2019-12-08 08:21:33

问题


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

How is this possible with Woocommerce?


回答1:


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;
}

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

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


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



来源:https://stackoverflow.com/questions/55240846/change-reply-to-email-address-in-all-woocommerce-emails-notifications

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!