Public Ticket #3825622

Product pricing per customer

Closed
Comments
1 Ticket
Quincy started the conversation 2 years ago on February 22, 2025 at 11:40am

Good afternoon,

I'd like to know if there is a simple way to give every customer a specific price per product, so a list width their own prices based on percentages.

For now I have to make a dynamic rule for every customer and every product, this option cost's me a lot of time.

Is there a way to make one price list with different products and different discounts per product assigned to one customer?

For example add multiple dynamic rules in one....


Best regards,


Quincy Smolders

Attached files:

2,762
KingsPlugins replied 2 years ago on February 22, 2025 at 6:48pm

Hello Quincy,

Thank you for purchasing our plugin,

 

I understand you'd be looking to create user-based price lists, and that the current system via rules is difficult to work with for many users / products.

This is something we are working on adding to the plugin as part of a price-lists feature that will allow controlling this in detail per user, but this feature is not available yet.

 

At the moment, one option I can suggest is that it is possible to set this for each product based on product meta keys (custom fields).

So for example by editing a product and setting the custom field 'b2bking_regular_price_user_jimsmith' = 100, this will set the product's price to $100 for the username jimsmith.

One way this could be used is by importing products and metadata (using an importer tool), or by directly setting custom fields when editing the product: https://woocommerce.com/document/custom-product-fields/

 

If you think that could help, let me know and I can share more details about all the possible keys and values that can be used this way.

 

Kind regards,

Stefan

1 Ticket
Quincy replied 2 years ago on February 23, 2025 at 8:28pm

Hi Stefan,

Thank You for the reply!

I understand what to do, can you also tell me how t do this by percentage discount instead of fixed prices?

I tried like this: b2bking_percentage_discount_user_admin = 100% but I think this is not the correct code

2,762
KingsPlugins replied 2 years ago on February 24, 2025 at 1:49pm

By default, we do not have that kind of notation for percentage discounts, but I can write a custom code snippet to allow this via a custom field such as b2bking_percentage_discount_user_admin 

Could you let me know a few details?:

  • Do you have only Simple products, or also Variable products? any other type of products in use such as bundles?
  • If you also have variable products, is your goal to add that kind of percentage discount on each variation, or each variable product? would different variations have different % discounts?

It affects how complex the snippet needs to be.

 

Kind regards,

Stefan

1 Ticket
Quincy replied 2 years ago on February 24, 2025 at 1:55pm

we only use simple products. So i hope thats not to much work. Our customers get their dicounts in percentage. In this way we never have to change the regular price’s per customer. When we update the regular price the customer keep’s the percentage discount. 

1 Ticket
Quincy replied 2 years ago on February 24, 2025 at 2:25pm

Another Question, when I use de Dynamic Rule Function and use the function "Discount as sale Price" on the fronted I see the regular price and the discount price. I there a way to hide the regular price and only show the discount price?


Thanks for the quick support!

2,762
KingsPlugins replied 2 years ago on February 26, 2025 at 10:43am

Hi again,

Thank you for the clarifications,

 

Another Question, when I use de Dynamic Rule Function and use the function "Discount as sale Price" on the fronted I see the regular price and the discount price. I there a way to hide the regular price and only show the discount price?

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

add_filter('b2bking_dynamic_recalculate_sale_price_badge', '__return_false');
add_filter('b2bking_dynamic_recalculate_sale_price_display', function($price_html, $product, $sale_price){
    return wc_price($sale_price);
}, 10, 3);

 

 

Regarding the code snippet to set a discount percentage via metadata, please add this code:

add_filter('b2bking_fixed_pricing_custom_price', function($price, $product_id){

	$user = wp_get_current_user();
	$percentage_discount = get_post_meta($product_id, 'b2bking_percentage_discount_user_'.$user->user_login, true);
	if (!empty($percentage_discount)){
		$price = $price * (100-$percentage_discount)/100;
	}

	return $price;
}, 10, 2);

You can then set for each product a key such as "b2bking_percentage_discount_user_admin" where admin is the username, and the value of the key is the percentage.

 

For example you can set "b2bking_percentage_discount_user_johndoe" to "25", to give the user johndoe a 25% discount on that product.

 

Kind regards,

Stefan

Sign In