How to send Customer invoice / Order details email notification Automatically In Woocommerce

enter image description here

I want to send Customer invoice / Order details email notification Automatically In Woocommerce.When i checking Customer invoice / Order email notification in woocommerce it have only way to send Customer invoice / Order email manually.I want to send Customer invoice / Order email notification when order status is pending payment.If there any function is available send Customer invoice / Order email automatically.Could You Please Help Me. Thanks in advance.

asked Feb 16, 2018 at 7:46 developerme developerme 1,905 2 2 gold badges 20 20 silver badges 35 35 bronze badges This answer will help you get started stackoverflow.com/questions/45375143/… Commented Feb 16, 2018 at 8:56

1 Answer 1

Use the woocommerce_email_headers filter with a condition that matches the Customer invoice / Order details email.

Make sure you set the email addresses like <[email protected]> as [email protected] alone failed for me.

function add_bcc_to_certain_emails( $headers, $object ) < $bcc_emails = '[email protected]>, [email protected]>'; // email types/objects to add bcc to $add_bcc_to = array( 'customer_invoice',//for the manually triggered Customer invoice / Order details email ); // if our email object is in our array if ( in_array( $object, $add_bcc_to ) ) < // change our headers $headers = array( $headers, 'Bcc: '.$bcc_emails.'\r\n', ); >return $headers; > add_filter( 'woocommerce_email_headers', 'add_bcc_to_certain_emails', 10, 2 );