Created
January 11, 2022 04:48
-
-
Save tanjiralmamun/3bd645d8a6064e13b2d8d566a3276649 to your computer and use it in GitHub Desktop.
Change reply-to email address from Admin to Vendor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#-- Change Reply-to Email Address from Admin to Vendor --# | |
function change_reply_to_email_address( $header, $email_id, $order ) { | |
if( $email_id =='customer_processing_order' ){ | |
$vendor_id = dokan_get_seller_id_by_order( $order->get_id() ); | |
$vendor = dokan()->vendor->get( $vendor_id ); | |
// HERE below set the name and the email address | |
$reply_to_name = $vendor->get_shop_name(); | |
$reply_to_email = $vendor->get_email(); | |
// 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; | |
} | |
add_filter( 'woocommerce_email_headers', 'change_reply_to_email_address', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment