WooCommerce BCC Completed Orders Email

Adding an audit trail to WooCommerce completed orders emails is a fairly easy task. We can achieve this by employing the filter woocommerce_email_headers and adding in a check for the object name customer_completed_order.

** This will work for WooCommerce version less than or equal to 2.2 **

** For WooCommerce version 2.3 and above they have changed the number of parameters passed to the filter **

21 thoughts on “WooCommerce BCC Completed Orders Email

    1. I think there was a formatting issue in my code. Try and copy and pasting it again the less than and equal than signs were being replaced with &lt. What version of WooCommerce are you using?

      1. Just replied to your comment notification email – this is not the case I would have noticed those tags – and have checked my ditto copy/paste saver.

        Saw exact code out in the wild on other sites and saw a couple of sudden comments in past month that this is no longer working.

        1. They have changed the number of parameters passed to the filter “woocommerce_email_headers”. Seems they did this after version 2.3 but I’m not entirely sure. I have posted a revised snippet above for WooCommerce version 2.3 and above. I’ve tested the code and it’s working. Let me know if you need any assistance.

          1. If i was to add more than one BCC, I guess we’d do it like this?:

            /**
            * BCC Email for orders completed for WooCommerce version 2.3 and above
            */
            add_filter( ‘woocommerce_email_headers’, ‘es_headers_filter_function’, 10, 3);

            function es_headers_filter_function( $headers, $id, $object ) {
            if ($id == ‘customer_completed_order’) {
            $headers .= ‘BCC: Sales ‘, ‘BCC: CustomerService ‘ . “\r\n”;
            }

            return $headers;
            }

  1. This is wierd man, I can’t get it to work whether it be a single email or multiple.

    I change it then test with a cheque order and just no dice…

    /**
    * BCC Email for orders completed for WooCommerce version 2.3 and above
    */
    add_filter( ‘woocommerce_email_headers’, ‘es_headers_filter_function’, 10, 3);

    function es_headers_filter_function( $headers, $id, $object ) {
    if ($id == ‘customer_completed_order’) {
    $headers .= ‘BCC: Sales ‘ . “\r\n”;
    }

    return $headers;
    }

    or

    /**

    * BCC Email for orders completed for WooCommerce version 2.3 and above

    */

    add_filter( ‘woocommerce_email_headers’, ‘es_headers_filter_function’, 10, 3);

    function es_headers_filter_function( $headers, $id, $object ) {
    if ($id == ‘customer_completed_order’) {
    $headers .= “BCC:vtobiaz@561media.com\r\n”;
    }

    return $headers;
    }

      1. Oh just noticed my code was all wacked in my comment so reposted, just disregard

  2. Either of THESE I mean…

    /**
    * BCC Email for orders completed for WooCommerce version 2.3 and above
    */
    add_filter( 'woocommerce_email_headers', 'es_headers_filter_function', 10, 3);

    function es_headers_filter_function( $headers, $id, $object ) {
    if ($id == 'customer_completed_order') {
    $headers .= 'BCC: Sales ' . "\r\n";
    }

    return $headers;
    }

    or


    /**

    * BCC Email for orders completed for WooCommerce version 2.3 and above

    */

    add_filter( 'woocommerce_email_headers', 'es_headers_filter_function', 10, 3);

    function es_headers_filter_function( $headers, $id, $object ) {
    if ($id == 'customer_completed_order') {
    $headers .= "BCC:vtobiaz@561media.com\r\n";
    }

    return $headers;
    }

  3. I really need to implement this bcc field. Trouble is I am not familar with WooCommerce to know which file to edit.

    I believe I need to set up a child theme/WooCommerce 2.3 and edit that theme.

    Is that correct?

    What file is it that I add the add_filter to?

    Thanks for helping this Newbee find his way.

    CraigMc

    1. Yes that’s correct. Edit the child theme’s function.php file and copy and paste the above code based on whatever version of WooCommerce you are using. I understand it can be daunting at first but after awhile it all makes sense 🙂

  4. Hi thanks for this!
    Do you trust the enable/disable checkboxes in the woo emails? I want to completely shut off the emails except for the new order received.
    I’m not sure if just clicking the checkbox will do it.

    Does it work or should I put in some code just to be safe?

    Mark

    1. I’ve used the checkboxes in the past and they are fine for disabling certain kinds of notifications. Best to use the code if you want to disable all notifications.

  5. Super helpful!!
    I just want to get bcc’d on the customer order processing email.
    ‘customer_processing_order’

    How could I just ask for that? Just substitute? I’m not sure if I’ll break the order

    1. Yes that’s correct. You could just check that the $id = ‘customer_processing_order’. I have not tested this so make sure you try it out in a test environment first.

Leave a Reply

Your email address will not be published. Required fields are marked *