• Resolved Spidervalve100

    (@spidervalve100)


    Hi all,

    Im trying to integrate my CRM to woocomerce. My CRM lets me bcc my emails into the crm. But in order to create a person (not an email address) I need the email formated as follows:

    FirstNameFromOrder LastNameFromOrder <[email protected]>

    I have been able to use the following code to BCC from woocomerce, but it bcc both admin and the customer so I get multiple entries.

    add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);
    
    function mycustom_headers_filter_function( $headers, $object ) {
        if ($object == 'customer_note') {
            $headers .= 'BCC: [email protected]' . "\r\n";
        }
    
        return $headers;
    }

    I have tried to do a few different things to get the recipients email into the format I want, but nothing works. Here is some code that did not work.

    function skyverge_add_customer_to_email_recipient( $recipient, $order ) {
    
    	$recipient .= $order->billing_first_name . ' ' . $order->billing_last_name . ' <' .  $order->billing_email . '>';
    	return $recipient
    
    }
    add_filter( 'woocommerce_email_subject_new_order', 'skyverge_add_customer_to_email_recipient', 10, 2 );

    I feel like I got so close, but im no programmer. Any help at all would be most appreciated.

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘woocomerce add First and Last name to customer email’ is closed to new replies.