Skip to content

Instantly share code, notes, and snippets.

@tomfordweb
Created September 10, 2018 20:22
Show Gist options
  • Save tomfordweb/c168c8cc7b8ae96e54b8a7858220a3a3 to your computer and use it in GitHub Desktop.
Save tomfordweb/c168c8cc7b8ae96e54b8a7858220a3a3 to your computer and use it in GitHub Desktop.
Woocommerce - BCC email for all order information
add_filter( 'woocommerce_email_headers', 'tfw_wooc_order_multiple_recipients', 10, 2);
function tfw_wooc_order_multiple_recipients( $headers = '', $id = '') {
$order_statuses = array(
'new_order',
'cancelled_order',
'customer_processing_order',
'customer_invoice',
'customer_refunded_order',
'customer_on_hold_oder',
// 'booking_cancelled',
// 'booking_confirmed',
// 'booking_notification',
// 'new_booking',
// 'customer_completed_renewal_order',
// 'customer_completed_switch_order',
// 'customer_payment_retry',
// 'customer_processing_renewal_order',
// 'customer_renewal_invoice',
// 'new_renewal_order',
// 'new_switch_order',
// 'suspended_subscription',
'payment_retry',
);
$emails = array(
'[email protected]'
);
if (in_array($id, $order_statuses)) {
$headers .= 'Bcc: ' . implode(',', $emails) . "\r\n";
}
return $headers;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment