How to change “reply to” email address for specific Woocommerce products

Question

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
NIL 2 weeks 2022-09-11T04:29:43-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse