Change "reply to" email address for specific Woocommerce products

Viewed 32

How can I run same function for specific product? I mean the header email will change when place specific products. no need to work on globally thanks

here is my code.

//My Code
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  = 'Nil';
    $reply_to_email = 'nil@gmail.com';

    // 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;
}
0 Answers
Related