Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • David Peck 690 posts 1896 karma points c-trib
    Jan 29, 2021 @ 06:51
    David Peck
    0

    Preventing discounts on some products

    I have a category of products (defined by a product/order line property) which must never have a discount applied.

    I'm aware that it is possible to configure a discounts to exclude these products when it is configured through the UI. However I'm hoping to find a client-proof way of achieving that, by implementing a hard coded rule.

    Is there perhaps an adjuster that I could override to achieve this?

    Thank you in advance.

  • David Peck 690 posts 1896 karma points c-trib
    Jan 29, 2021 @ 07:02
    David Peck
    0

    I may have found my answer in CalculateOrderAdjustedPricesPipeline? I'll investigate that at my next opportunity.

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jan 29, 2021 @ 09:41
    Matt Brailsford
    100

    Hmm,

    Just thinking, one thing you could try doing is creating your own Order Line Product Rule inheriting from the default and have that auto filter out products that must never be discounted.

    I think you could then force the original discount rule to be removed by calling

    composition.WithCollectionBuilder<DiscountRuleProviderCollectionBuilder>()
        .Exclude<OrderLineProductDiscountRuleProvider>();
    

    I've never tried this, but could be worth a shot.

    Matt

  • Sue Taylor 21 posts 102 karma points
    Dec 06, 2022 @ 11:32
    Sue Taylor
    0

    Hi I realise this is an old question but I'm wanting to do the exact same thing - always exclude certain 'products', in my case donations, from any discount calculations without relying on having to configure something in the user interface.
    I didn't fully understand the solution above - although I managed to create an override for the OrderLineProductDiscountRuleProvider which filtered out certain 'products', it would still require an end-user to use it in every discount configuration?

    Are there any examples of how to do this? Or maybe an easier method in the later versions of vendr? Any help on this would be much appreciated! Thanks, Sue

  • David Peck 690 posts 1896 karma points c-trib
    Feb 10, 2021 @ 11:52
    David Peck
    1

    This did work, but I needed to remove some additional rules/rewards to prevent their use.

Please Sign in or register to post replies

Write your reply to:

Draft