I would like to set up dynamic rules to change the price of a product or category for a user that takes a percentage off the products regular price raher than the customers wholesale group price.
So, for instance if the products regular price was £100 and a customers wholesale group price for that product was £50, I would like to set up a discount for that product for 60% off the RRP, or regular price, giving that customer a price of £40 but instead I get £20 - which is 60% off the wholesale price of £50, rather than off the £100.
Is there a way of setting this up so it discounts from the regular price?
Just a quick note - this is a feature of B2BKing rather than SalesKing (the ticket was submitted under the SalesKing presales category). If you already have B2BKing, could you please share your purchase code so we can assist with support?
Regarding your question, you can make the dynamic rule discount from the regular price instead of the group price by adding this code snippet to your theme's functions.php or any code snippets plugin:
One important thing to be aware of though: since the discount percentage will now apply to the regular price (£100 in your example) rather than the group price (£50), it's possible that the resulting price ends up being higher than the wholesale group price.
For example, if you set a 20% discount rule, the customer would pay £80 (20% off £100 regular price), rather than their £50 wholesale group price.
Hi
I would like to set up dynamic rules to change the price of a product or category for a user that takes a percentage off the products regular price raher than the customers wholesale group price.
So, for instance if the products regular price was £100 and a customers wholesale group price for that product was £50, I would like to set up a discount for that product for 60% off the RRP, or regular price, giving that customer a price of £40 but instead I get £20 - which is 60% off the wholesale price of £50, rather than off the £100.
Is there a way of setting this up so it discounts from the regular price?
Many thanks
Richard.
Hi Richard,
Thanks for reaching out!
Just a quick note - this is a feature of B2BKing rather than SalesKing (the ticket was submitted under the SalesKing presales category). If you already have B2BKing, could you please share your purchase code so we can assist with support?
Regarding your question, you can make the dynamic rule discount from the regular price instead of the group price by adding this code snippet to your theme's functions.php or any code snippets plugin:
add_filter('b2bking_discount_rule_regular_price', function($price, $product){ $product_id = $product->get_id(); $saleprice = get_post_meta($product_id,'_regular_price', true); if (!empty($saleprice)){ $price = floatval($saleprice); } return $price; }, 10, 2);One important thing to be aware of though: since the discount percentage will now apply to the regular price (£100 in your example) rather than the group price (£50), it's possible that the resulting price ends up being higher than the wholesale group price.
For example, if you set a 20% discount rule, the customer would pay £80 (20% off £100 regular price), rather than their £50 wholesale group price.
Let me know if you have any questions!
Kind regards,
Stefan