I\'m looking to filter the email headers of the new order form in woocommerce. I\'m trying to replace the customer email address with the main site admin email address. We n
The correct way to make it work is:
add_filter( 'woocommerce_email_headers', 'new_order_reply_to_admin_header', 20, 3 );
function new_order_reply_to_admin_header( $header, $email_id, $order ) {
if ( $email_id === 'new_order' ){
$email = new WC_Email($email_id);
$header = "Content-Type: " . $email->get_content_type() . "\r\n";
$header .= 'Reply-to: ' . __('Administrator') . ' <' . get_option( 'admin_email' ) . ">\r\n";
}
return $header;
}
This code goes on function.php file of your active child theme (or theme). Tested and works.