Update : Added compatibility with Woocommerce version 3+
, $order . . , . $your_email . :
function testing_hook_headers( $headers, $id, $order ) {
$order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id;
$your_email = '<name@email.com>';
$headers = "To: Order Num $order_id $your_email";
return $headers;
}
add_filter( 'woocommerce_email_headers', 'testing_hook_headers', 10, 3);
, :
function techie_custom_wooemail_headers( $headers, $email_id, $order ) {
$order_id = method_exists( $order, 'get_id' ) ? $order->get_id() : $order->id;
$email = get_post_meta( $order_id, '_approver_email', true );
$emails = array('eee@hotmail.com', $email);
switch( $email_id ) {
case 'new_order':
$headers .= 'Bcc: ' . implode(',', $emails) . "\r\n";
break;
case 'customer_processing_order':
$headers .= 'Bcc: ' . implode(',', $emails) . "\r\n";
break;
case 'customer_completed_order':
case 'customer_invoice':
$headers .= 'Bcc: ' . implode(',', $emails) . "\r\n";
break;
default:
}
return $headers;
}
add_filter( 'woocommerce_email_headers', 'techie_custom_wooemail_headers', 10, 3);
, .