Saturday, November 19, 2022
HomeWordPress DevelopmentInsert a customized area as a second electronic mail deal with to...

Insert a customized area as a second electronic mail deal with to a accomplished order in WooCommerce


I am wanting to make use of a customized area from “Checkout Subject Editor for WooCommerce” to make use of as a second electronic mail deal with to a accomplished order in WooCommerce. I began through the use of this code which works completely for a single deal with:

add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 2);
    perform mycustom_headers_filter_function( $headers, $object ) {
    if ($object == 'customer_completed_order') {
        $headers .= 'BCC: My identify <my@electronic mail.com>' . "rn";
    }
        return $headers;
}

I want to get the ‘additional_contact’ area (which comprises an electronic mail deal with) as an alternative of ‘my@electronic mail.com’ as a variable. I assume we’ve to do one thing like this (higher with out the errors…):

add_filter( 'woocommerce_email_headers', 'mycustom_headers_filter_function', 10, 3);
    perform mycustom_headers_filter_function( $headers, $object, $custom_mail) {
    if ($object == 'customer_completed_order') {
    $custom_mail = get_field( 'additional_contact' );
    $headers .= 'BCC: My identify <'.$custom_mail.'>' . "rn";
    }
        return $headers;
}

Thanks upfront on your assist.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments