Untitled
unknown
plain_text
2 years ago
568 B
18
Indexable
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'custom_prevent_completed_order_email_for_b2b_users', 10, 2 );
function custom_prevent_completed_order_email_for_b2b_users( $recipient, $order ) {
if ( ! is_a( $order, 'WC_Order' ) ) {
return $recipient;
}
$user_id = $order->get_customer_id();
if ( !$user_id ) {
return $recipient;
}
$is_b2b_user = get_user_meta( $user_id, 'b2bking_b2buser', true );
if ( $is_b2b_user === 'yes' ) {
$recipient = '';
}
return $recipient;
}
Editor is loading...
Leave a Comment