Adding a second email address to a completed order in WooCommerce [closed]

There’s actually a filter that you can use, see abstract-wc-email.php, line 214:

return apply_filters( 'woocommerce_email_recipient_' . $this->id, $this->recipient, $this->object );

you can put the following in your functions.php:

add_filter( 'woocommerce_email_recipient_customer_completed_order', 'your_email_recipient_filter_function', 10, 2);

function your_email_recipient_filter_function($recipient, $object) {
    $recipient = $recipient . ', [email protected]';
    return $recipient;
}

the only drawback is that the recipient will see both your address & his own in the To: field.


Alternatively, building on Steve’s answer, you can use the woocommerce_email_headers filter. the $object passed allows you to only apply this to the completed order email:

add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);

function mycustom_headers_filter_function( $headers, $object ) {
    if ($object == 'customer_completed_order') {
        $headers .= 'BCC: My name <[email protected]>' . "\r\n";
    }

    return $headers;
}

Leave a Comment

tech