1

By default, WooCommerce only sends On-Hold order notifications to customers (not sure why, as it seems having a shop manager know when an order is on-hold would be pretty important...)

I have tried implementing the following snippets into my child theme's functions.php based on the threads I have found researching here and on Google: Send on-hold order status email notification to admin

add_filter( 'woocommerce_email_headers', 'custom_admin_email_notification', 10, 3);
function custom_admin_email_notification( $headers, $email_id, $order ) {

    if( 'customer_on-hold_order' == $email_id ){
        // Set HERE the Admin email
        $headers .= 'Bcc: My name <my@email.com>\r\n';
    }
    return $headers;
}

I have also tried the following snippet from the same thread:

// Send on-hold order status email notification to admin
add_filter( 'woocommerce_email_headers', 'custom_admin_email_notification', 10, 3);
function custom_admin_email_notification( $headers, $email_id, $order ) {

    if( strpos($email_id,'hold') > 0 ){
        $headers .= 'Bcc: Admin User <admin@example.com>'. "\r\n";
    }
    return $headers;
}

None of these seem to work when an order is changed from Pending Payment to On-Hold. Yes, I have changed the email in the snippets to my admin email. I am looking for a solution where an admin will be BCC'd on the Customer On-Hold email either when this happens automatically (from pending payment to on-hold) or manually when editing an order.

7uc1f3r
  • 28,449
  • 17
  • 32
  • 50
David
  • 144
  • 1
  • 12

1 Answers1

3
  • Adding utf8_decode might help
  • Replace customer_on-hold_order with customer_on_hold_order
  • Tested with Wordpress 5.8.1 and WooCommerce 5.6.0

So you get:

function filter_woocommerce_email_headers( $header, $email_id, $order ) {
    // Compare
    if ( $email_id == 'customer_on_hold_order' ) {      
        // Prepare the the data
        $formatted_email = utf8_decode( 'My test <my_test@email.com>' );

        // Add Bcc to headers
        $header .= 'Bcc: ' . $formatted_email . '\r\n';
    }

    return $header;
}
add_filter( 'woocommerce_email_headers', 'filter_woocommerce_email_headers', 10, 3 );
7uc1f3r
  • 28,449
  • 17
  • 32
  • 50