Copied to clipboard

Flag this post as spam?

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


  • Ana 5 posts 75 karma points
    Nov 01, 2020 @ 09:47
    Ana
    0

    Discounts with order line quantity conditions don't apply correctly

    Hi Matt

    I need some help regarding the discounts in vendr. There either is a bug in the discounting logic, or I misunderstand how to set up the discounting rules to apply to my (very simple) scenario. What I want to achieve is:

    1. if somebody orders more than 1 (but less than 5) of a specific product variant, then I want to discount the unit price by 20%
    2. if somebody orders 5 or more, I want to discount the unit price by 28%

    I couldn't get this to work in my local project, so I downloaded the latest version of VendrDemoStore and applied the same discounting rule there and got the same result.

    Discount settings look like this: Discount setting 20%OFF for more than 2 Discount setting 28%OFF for more than 4

    Results look like this:

    Errors when applying discounts: Errors applying discounts - scenario 1 Errors applying discounts - scenario 2

    Successfully applied discounts: Discounts applied successfully - scenario 1 Discounts applied successfully - scenario 2

    No discounts applied (success): No discounts applied

    PS: For more overview, I added a row for each order line in the cart table that displays the applied discounts (which then later on would get applied in the checkout process).

    Do you see any mistakes in my discount rules? If not, can you please check in the Vendr source code to see where the problem is?

    Note: the problem is there also if I try to make the rule with the <= / >= operators.

    As far as I can see, the error occurs when the 20% discount rule applies to one of the order lines. Then, if there is an order line with quantity 1, also this one gets a 20% discount. As if in this case the > 1 condition on the 20%OFF rule would not be respected.

    Thank you in advance for your efforts and support.

    Greets, Ana

  • Ana 5 posts 75 karma points
    Nov 05, 2020 @ 11:07
    Ana
    0

    Hi again

    In the meanwhile I found a workaround for this problem, which is to only set 1 condition in the discount rules:

    20OFF Discount Rule: OrderLineQuantity > 1

    20% off Order Line Unit Prices

    28OFF Discount Rule: OrderLineQuantity > 4

    10% off Order Line Unit Prices (which in the end together with 20% gives the 28% total discount)

    I still think there is a bug somewhere in the discount logic (?) and it should be possible to set 2 conditions on 1 discount rule without the behavior described before.

    Any further inputs to this topic are appreciated.

    Greets, Ana

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Nov 09, 2020 @ 15:28
    Matt Brailsford
    0

    Hi Ana,

    My apologies for the late reply on this. I messed up my forum notifications so wasn't getting notified of new posts 🤦‍♂️

    Thanks for the well documented issue, I will go and check this immediately for you. From my initial view of your discount setup, this should indeed be working as you would have expected, but I will dig in and see why it's not.

    Really glad you managed to find a workaround in the meantime, but I'll post an update once I know what is going on.

    Matt

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Nov 09, 2020 @ 16:17
    Matt Brailsford
    101

    Just to follow up on this, I believe I have found the issue and it is indeed a bug.

    It boils down to our rule logic within the rule groups. Rule groups act as a filter and for each rule, we track the order lines that fulfil that rule. These are then passed into the next rule to continue the filter.

    The problem was that for all rule group types ("Any" and "All") the tracking behavior was always using an "Any" type rule, tracking any order lines that met any of the rules.

    I've updated this locally with a fix and will add it to the upcoming 1.3.4 update. I'll also report this on the issue tracker for the record.

    Thanks again for reporting this, and apologies I couldn't get this too you sooner.

    Matt

  • Ana 5 posts 75 karma points
    Nov 11, 2020 @ 11:09
    Ana
    0

    Hi Matt

    Thank you very much for your effort and the reply!

    I am happy you could find and fix the problem. I thought there must be something deep down in the rule-logic, I know these things are sometimes hard to debug, especially when a complex set of rules is being applied.

    Thanks again, H5YR! :-)

    Greets, Ana

Please Sign in or register to post replies

Write your reply to:

Draft