How to get the $ recipient from the Woocommerce emails

1

I'm trying to get the recipient's email from the Woocommerce emails that go to Admin. I know there are other ways to do this but I need to do this through the comparative between the recipient and Admim WP.

////////// BCC EMAIL /////////////
function bcc_email_headers( $headers ){
   $recipient = get_from_address();
   $admin = get_option('admin_email');

    if ( $recipient == $admin ){
        $headers .= 'BCC: Name <[email protected]>' . "\r\n";
    }
    return $headers;
}
add_action( 'woocommerce_email_headers', 'bcc_email_headers', 10, 3 );

Or another way I'd look, it would be through order_status . I've tried this:

////////// BCC EMAIL by Order Status /////////////
function bcc_email_headers( $headers, $order ){
   global $woocommerce;

    if ( wc_get_order() == 'meu_status' ){
        $headers .= 'BCC: Name <[email protected]>' . "\r\n";
    }
    return $headers;
}
add_action( 'woocommerce_email_headers', 'bcc_email_headers', 10, 3 );

But it also does not work

    
asked by anonymous 02.08.2015 / 22:22

0 answers