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?
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.
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
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.
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
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 anIsFulfilled
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 befalse
but if it does meet the criteria, it should betrue
.Hi Matt,
thanks for your advise. But I can't seem to find the
IsFulfilled
property inside ofDiscountCode
, 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/Hi Martin,
You won't find
IsFulfilled
on the actualDiscountCode
entity as it exists on theAppliedDiscountCode
entity which is what an ordersorder.DiscountCodes
collection containshttps://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 theAppliedDiscountCode
is an instance of the discount code in use.Hope this helps
Matt
Hi Matt,
this is what I was looking for! Thank you!
Kind regards Martin
is working on a reply...