Public Ticket #3001429

Cart -> get group

Closed
Comments
4 Tickets 1
Prokop Suchanek started the conversation 5 years ago on March 13, 2022 at 10:13pm

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

2,762
KingsPlugins replied 5 years ago on March 14, 2022 at 6:08pm

Hi 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