send-quote email send copy to user email address
-
Hi Pinal,
I am trying to send a copy of send-quote email to user_email address using woocommerce_email_headers filter but for some reason it does not work. I think $order variable cannot be found.
My code works if $user_email and $user_name are given and set to a specfic value like [email protected], this code works as well if $email_id is woocommerce ‘processing_order’ email but not if it is ‘qwc_send_quote’.Here is my code
function filter_woocommerce_email_headers( $header, $email_id, $order ) { // For a given email id & user id exists (no guests) if ( $email_id == 'qwc_send_quote' && $order->get_user_id() > 0 ) { // Get an instance of the WP_User object $user = $order->get_user(); // Get user email $user_email = $user->user_email; // Get first & last name $user_name = $user->first_name . ' '; $user_name .= $user->last_name; // Prepare the the data $formatted_email = utf8_decode( $user_name . ' <' . $user_email . '>' ); // Add Cc to headers $header .= 'Cc: ' . $formatted_email . '\r\n'; } return $header; } add_filter( 'woocommerce_email_headers', 'filter_woocommerce_email_headers', 10, 3 );
Could you please help me with that issue?
Thank you
Jean
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘send-quote email send copy to user email address’ is closed to new replies.