• Resolved arturskolak

    (@arturskolak)


    Hello, currently we are trying to implment B2B king to our website, however we have one issue. I have set up dynamic discount rules in B2B King. For example, B2B users receive a 20% discount on products in a specific category. This works fine for products with only a regular price. However, when a product has both a regular price and a sale price, the B2B discount is calculated from the regular price, not the sale price, which is causing issues.Example:

    • Regular Price: €10
    • Sale Price: €6.5
    • B2B Discount: 20%

    Currently, B2B users see a price of €8, because the 20% discount is being applied to the regular price (€10). What I want is for the discount to apply to the sale price, so that the B2B user would receive a price of €5.20 (20% off the sale price of €6.5).Goal:

    B2B users should always get the discount applied to the sale price when a sale price is available. If no sale price is set, then the discount should apply to the regular price.What I’ve Tried:

    I’ve tried several approaches using custom code and applying filters to modify the discount logic, but the discount is still being calculated from the regular price instead of the sale price.

    Could you provide assistance on how to modify the discount calculation so that it always uses the sale price for B2B users when available?

    Thank you in advance for your help!

Viewing 1 replies (of 1 total)
  • Plugin Author WebWizards

    (@webwizardsdev)

    Hi there and thank you for using our plugin,

    By default I’m afraid the plugin does not have a feature for this. Discounts simply recalculate the sale price starting with the regular price.

    There is a code snippet that can do this by implementing a fake internal regular price. I’m afraid this snippet is currently only implemented in the Premium version of the plugin, so it will not work if you have only B2BKing Core. If it helps, I mention the code here:

    add_filter('b2bking_discount_rules_start_with_sale_price','__return_true');

    Could that help solve it for you? Or are you using the Core version only?

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.