Это должно предотвратить добавление ответа в заголовок электронного письма, если он совпадает с получателем:
/**
* Change reply to email address for customer emails.
*
* @param array $header - The email headers.
* @param string $email_id
* @param object $order WC_Order
* @param object $email - The WC_Email class object for this particular email.
* @return array
*/
function change_reply_to_email_address( $header, $email_id, $order, $email ) {
// HERE below set the name and the email address
$reply_to_name = 'Jack Smith';
$reply_to_email = 'jack.smith@doamin.tld';
// Set the reply to email only if it's not one of the recipients.
if( false !== strpos( $reply_to_email, $email->get_recipient() ) ) {
$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, 4 );
Похоже, нет способа проверить, является ли электронное письмо администратором или нет,так что в качестве альтернативы вы можете условно проверить наличие определенных идентификаторов электронной почты.