2
votes

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.

enter image description here

Thanks in advance!!!!!!

1
This answer will help you get started stackoverflow.com/questions/45375143/…Andrew Schultz

1 Answers

-1
votes

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 );

Snippet amended from https://jessepearson.net/2016/10/adding-bcc-emails-woocommerce/