Coming from this question adding-bcc-recipient-to-woocommerce-email-notification... I try similar but the ACF value is coming from the product.
I did the following:
add_filter( 'woocommerce_email_recipient_new_order', 'acf_recipient_new_email_notification', 15, 2 );
function acf_recipient_new_email_notification( $recipient, $order ) {
if( class_exists( 'acf' ) ){
$partner_email = get_field( 'email_recipient_new_order' );
}
foreach($order->get_items() as $item_id => $item ) {
if( $partner_email ) {
$recipient .= ', ' . $partner_email;
break;
}
}
return $recipient;
}
No result is given. What goes wrong here?