Comments 1Prokop Suchanek started the conversationMarch 13, 2022 at 10:13pmHi there! I have some code in a snippet that works on vat: add_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false' ); I would like to exempt b2b users. So what I am looking for is wrapping this code in an if statement, that excludes b2b group, such as: if ($b2bking_b2buser = false) { add_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false' ); } What is the correct syntax for detecting if current user is a member of b2b users? Cheers 1Prokop Suchanek repliedMarch 13, 2022 at 10:29pmI found the answer here:https://webwizards.ticksy.com//ticket/2813000/$user_id = get_current_user_id();$user_is_b2b = get_user_meta($user_id,'b2bking_b2buser', true);if ($user_is_b2b === 'yes'){ $group_id = get_user_meta($user_id, 'b2bking_customergroup', true); $group_name = get_the_title($group_id);}Thanks!1 Like 2,218WebWizards repliedMarch 14, 2022 at 6:08pmHi there,Glad to hear you found that. Yes, you could use the following to exclude B2B users: $user_id = get_current_user_id(); $user_is_b2b = get_user_meta($user_id,'b2bking_b2buser', true); if ($user_is_b2b !== 'yes'){ add_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false' ); } Sign in to reply ...
Hi there!
I have some code in a snippet that works on vat:
add_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false' );
I would like to exempt b2b users.
So what I am looking for is wrapping this code in an if statement, that excludes b2b group, such as:
if ($b2bking_b2buser = false) {
add_filter( 'woocommerce_adjust_non_base_location_prices', '__return_false' );
}
What is the correct syntax for detecting if current user is a member of b2b users?
Cheers
I found the answer here:
https://webwizards.ticksy.com//ticket/2813000/
$user_id = get_current_user_id();
$user_is_b2b = get_user_meta($user_id,'b2bking_b2buser', true);
if ($user_is_b2b === 'yes'){
$group_id = get_user_meta($user_id, 'b2bking_customergroup', true);
$group_name = get_the_title($group_id);
}
Thanks!
Hi there,
Glad to hear you found that. Yes, you could use the following to exclude B2B users: