I am building a site with Woocommerce and YITH Woocommerce Booking. I have added an ACF field to include a different email in each Booking and send mail from the new Booking to the email included in the ACF field and the administrator email.
When I directly add an email in my code instead of the variable it works perfectly, but when I change it back to take the email from the ACF field it doesn't work for me.
I have the following code in my functions.php file but it doesn't work for me. What can I have wrong?
add_filter( 'woocommerce_email_headers', 'new_booking_client', 9999, 3 );
function new_booking_client( $headers, $email_id, $order ) {
if ( 'yith_wcbk_admin_new_booking' == $email_id ) {
$client_email = get_field( 'e_mail_prestador');
$headers = "BCC: Name <" . $client_email . ">\r\n";
};
return $headers;
}