0
votes

When the order status in WooCommerce is set from pending to processing I can send an email to my customer. But I need to send an email only to a custom email adresse instead of the customer default address.

Is there a hook or filter for the functions.php file?

enter image description here

1

1 Answers

2
votes

This custom function hooked in woocommerce_email_recipient_customer_processing_order filter hook, will do the job (Set in it your replacement email):

add_filter( 'woocommerce_email_recipient_customer_processing_order', 'processing_order_replacement_email_recipient', 10, 2 );
function processing_order_replacement_email_recipient( $recipient, $order ) {
    if ( ! is_a( $order, 'WC_Order' ) ) return $recipient;

    // Set HERE your replacement recipient email(s)… (If multiple, separate them by a coma)
    $recipient = '[email protected]';
    return $recipient;
}

Code goes in function.php file of your active child theme (or theme) or also in any plugin file.

Tested and works


To add the custom recipient to the customer email, you should use this instead (if needed):

$recipient .= ',[email protected]';