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?
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 = '[email protected]';
// 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With