Would it work if we just applied the above code snippets for specific users only? or excluded specific users?
We could do that by specifying a user ID or username in the snippet.
For example:
add_filter('b2bking_dynamic_recalculate_sale_price_display', function($pricehtml, $product, $sale_price){
$user = wp_get_current_user();
if ($user->user_login === 'testusername'){
return wc_price($sale_price);
}
return $pricehtml;
}, 10, 3);
add_filter('b2bking_dynamic_recalculate_sale_price_badge', function($val){
$user = wp_get_current_user();
if ($user->user_login === 'testusername'){
return wc_price($sale_price);
}
return $val;
}, 10, 1);
The above only applies the code snippet for the user with username ‘testusername’