-1

I have a WooCommerce shop and it sends emails on every product order submission. I need to change the sender email address just for specific products into a custom address.

Already I am trying to achieve this using this code snippet to no avail:

add_filter('wp_mail_from', 'new_mail_from');

function new_mail_from($old) {
    return '[email protected]';
}

1 Answer 1

1

You have to use this filter:

add_filter( 'woocommerce_email_recipient_new_order', function( $recipient, $object ){
  if($conditional){
    $recipient = '[email protected]';
  }
  return $recipient;
});
2
  • but how add the conditionality for specific product ?
    – ELE
    Commented Mar 29, 2020 at 17:28
  • and i neet play this filter for : wp_mail_from, no woocommerce_email_recipient_new_order :(
    – ELE
    Commented Mar 29, 2020 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.