Copied to clipboard

Flag this post as spam?

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


  • Martin Pawollek 17 posts 148 karma points
    Jun 10, 2022 @ 14:34
    Martin Pawollek
    0

    Discount codes being redeemed even when custom rules are unfulfilled

    Hi Matt,

    we're working with some custom rules for our discounts, which is working as intended. But I've noticed, that a discount would be applied to an order, even when the rules are not fulfilled. This is something we want to prevent.

    I've checked the database table 'vendrOrderAppliedDiscountCode' and noticed the 'isFulfilled' is being set to 0.

    Now, is there any way to check the fulfillment status for a discount in the code? I wasn't able to find any information in the Discount object or in the Order object. Did I miss something?

    Kind regards, Martin

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 10, 2022 @ 14:38
    Matt Brailsford
    0

    Hi Martin,

    Any code that is a valid code (ie, it exists) will be added to the order, but that's not to say that it is applying a discount if the criteria for that discount isn't met.

    All orders contain a DiscountCodes collection, with each entry holding a reference to the code itself and an IsFulfilled property to say whether the discount actually applies or not.

    So if your rules are working correctly, and the order doesn't meet the criteria, then the IsFulfilled should be false but if it does meet the criteria, it should be true.

  • Martin Pawollek 17 posts 148 karma points
    Jun 13, 2022 @ 06:08
    Martin Pawollek
    0

    Hi Matt,

    thanks for your advise. But I can't seem to find the IsFulfilled property inside of DiscountCode, it's also not part of the reference: https://vendr.net/docs/core/2.1.0/umbraco-v9/reference/vendr-core/vendr-core-models/discountcode/

  • Matt Brailsford 4125 posts 22223 karma points MVP 9x c-trib
    Jun 13, 2022 @ 08:20
    Matt Brailsford
    100

    Hi Martin,

    You won't find IsFulfilled on the actual DiscountCode entity as it exists on the AppliedDiscountCode entity which is what an orders order.DiscountCodes collection contains

    https://vendr.net/docs/core/2.1.0/umbraco-v9/reference/vendr-core/vendr-core-models/applieddiscountcode/#content

    The difference it that DiscountCode is the definition of the discount code, where as the AppliedDiscountCode is an instance of the discount code in use.

    Hope this helps

    Matt

  • Martin Pawollek 17 posts 148 karma points
    Jun 13, 2022 @ 09:51
    Martin Pawollek
    0

    Hi Matt,

    this is what I was looking for! Thank you!

    Kind regards Martin

Please Sign in or register to post replies

Write your reply to:

Draft