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 'nombre@tudominio.es';

You have to use this filter:

add_filter( 'woocommerce_email_recipient_new_order', function( $recipient, $object ){
    $recipient = 'modified-recipient@gmail.com';
  return $recipient;
  • but how add the conditionality for specific product ? – ELE Mar 29 '20 at 17:28
  • and i neet play this filter for : wp_mail_from, no woocommerce_email_recipient_new_order :( – ELE Mar 29 '20 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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