问题
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