14,000+ Active Installs
4,97 Star Review Average

Tips & Tricks: Make 'Fixed Price' rule have priority over discounts.

July 15, 2021

By default, if you combine fixed price rules with discount rules, they will combine in their effects. For example, if you have a product that costs $500 for regular users, and you have 2 rules:

-> fixed price: $250 for B2B users

-> discount: 50% for B2B users

The results is that the price will show as $125, reduced from $250. This works great in many situations, but not all.

There are setups where you may want discounts to not be given to a user, if that user already has a fixed price rule.

This can be achieved by adding the following snippet to the site:

add_filter('b2bking_get_offer_product_id', function($offer_id,$current_product_id, $rule_type){

	// if this is a discount rule
	if ($rule_type === 'discount'){
		// if user has any fixed price rules
		$fixed_price_rules = get_transient('b2bking_fixed_price_'.$current_product_id.'_'.get_current_user_id());
		$fixed_price_parent_rules = get_transient('b2bking_fixed_price_parent_'.$current_product_id.'_'.get_current_user_id());

		if (!empty($fixed_price_rules) || !empty($fixed_price_parent_rules)){
			return $current_product_id;

	return $offer_id;
}, 10, 3);

Please note that the above currently works only for discount rules that have the "show discount as sale price" checkbox enabled.

B2BKing is a product made with passion by SNP Digital, that we are constantly developing, supporting and improving.

Buy B2BKing


$199 $139

linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram