I am developing my site by custom theme development and I have created the dynamic rule for hidden prices for a specific group of users.
But still the users are able to see the prices although they can not place order as the add to cart button is disabled or hidden when rule is enabled , this issue is on both shop and product details page .
For the reference I am sharing the code snippet of my pricing template , please check if I am missing any thing here that is making these prices to be visible.
Note : I have customize my template to show the prices based on a tax toggle i.e. with or without tax, and it is working with different prices for different group as well on issue is with hidden prices rule.
Normally B2BKing hooks into get_price_html so you could use `$product->get_price_html()` which would automatically respect B2BKing's hidden price rules.
However, I understand you might prefer your custom display logic, esp. as you are also using other tax code.
Another option is to specifically check for hidden price rules, as follows:
// Add this check at the start of your price display logic
$response = b2bking()->get_applicable_rules('hidden_price', $product->get_id());
if ($response !== 'norules' && !empty($response[0])){
// Price should be hidden, don't display anything
return 'Price is hidden, sorry!';
}
// Your existing price display code continues here
if ( $product->is_type( 'variable' ) ) {
// ... rest of your code
I am developing my site by custom theme development and I have created the dynamic rule for hidden prices for a specific group of users.
But still the users are able to see the prices although they can not place order as the add to cart button is disabled or hidden when rule is enabled , this issue is on both shop and product details page .
For the reference I am sharing the code snippet of my pricing template , please check if I am missing any thing here that is making these prices to be visible.
Note : I have customize my template to show the prices based on a tax toggle i.e. with or without tax, and it is working with different prices for different group as well on issue is with hidden prices rule.
file:
wp-content hemes heme-namewoocommerceloopprice.php
Hi Hassan,
Glad to assist,
Normally B2BKing hooks into get_price_html so you could use `$product->get_price_html()` which would automatically respect B2BKing's hidden price rules.
However, I understand you might prefer your custom display logic, esp. as you are also using other tax code.
Another option is to specifically check for hidden price rules, as follows:
Let me know if you need any clarification!
Kind regards,
Stefan