A person has a promotion, could be built in, could be custom, could be manual, etc. and same person is scratching heads over why the promotion hasn’t been applied on the checkout page (or in the cart). So, I’ll try to make a checklist from my experience why a promotion is not applying.
I’m sure I will add more cases as time goes, but this is what I can come up with so far. There are a lot of promotion specific cases where it won’t be applied, but if you believe it should be applied, check this list before looking at the promotion processor itself.
The common cases
- The promotion isn’t active
Super easy to check this. The Marketing UI will give hints fading your Promotion or entire Campaign if it’s inactive, but check the following fields on both the Promotion and Campaign (if the Scheduling is set as “Same as the campaign”).
- The promotion has a coupon code
Perhaps you missed or forgot that you entered a coupon code for the promotion, that you haven’t applied to the cart? If it has a coupon code which the cart doesn’t have, the promotion engine will filter it out before starting the evaluation.
- The market of the SalesCampaign doesn’t match the cart
SalesCampaign can be restricted to specific Markets, or “All” (as for built in features at least, you can extend this to allow several but not all). Make sure your cart has the same market.
- There is a Visitor group selected that your customer doesn’t have
On SalesCampaigns, you can have all Promotion children to only get applied if a certain Visitor Group has been applied. Make sure the Visitor Group criterion is fulfilled, if there is any set on the SalesCampaign.
P.S. Don’t build a visitor group like that D.S.
- You’ve reached a Redemption Limit
Promotion level, you can set some redemption limits per order per customer and total overall usage. If you set one of these values and used the promotion in purchases more than that value, your promotion will not be selected due to this.
A bit less common cases
- You have disabled the promotion type showing up in the Marketing UI
You can, by code, disable some promotion types. Maybe because you don't want the marketers to be able to create them, or that your code base doesn't support it. You do it in your initialization by using a PromotionTypeHandler. If you don't see the promotion type you want to create in the UI, head over to the documentation of hiding promotion types and then check if you are doing exactly that.
- Another Promotion is excluding yours
You can set up that some promotions shouldn’t be combined. Effectively, taking priority into account, there might be another Promotion with higher priority that excludes yours. You can see all the priority and exclusions clicking on this button when you’re in the Commerce -> Marketing start page. Put your promotion in the top priority if you want to test if that’s the issue.
- The Evaluation of the promotion fails
This one is a bit harder to help with, as it differs from Promotion to Promotion, what implementation of the PromotionProcessor exists. If it’s your custom Promotion, you have a much easier as you can just debug the Processor you wrote.
Note that before running the Evaluate method, it will run a CanBeFulfilled method on your processor. If it doesn’t exist it will fallback to the CanBeFulfilled on the PromotionProcessorBase that simply returns true. But if you have implemented a CanBeFulfilled method to make it performant, make sure that one returns true as well. If you are inheriting from some pre built processor, such as GetItemDiscountProcessorBase, that one will have a built in CanBeFulfilled with some logic.
Another thing I can recommend checking here is if you have a “Spend Amount” condition in your promotion, or a “Recieve Discount Amount” in the reward, make sure you have a value in the same currency as the cart. Otherwise it won’t be fulfilled as it doesn’t know how much to give you.
The rare cases
- (Entry level only) You have an item that should fulfill condition but is excluded by an entry filter
Quite rare this would happen by accident, but I have done it to myself and felt quite stupid for a moment. Make sure that if you’ve set up one of these your items are not affected by that excluder.
- (Manual promotion only) You are applying the promotions in the wrong way
If you want to apply a manual promotion (creating a PromotionInformation object in memory and applying that one ,see this forum post for info on how to do it), you can’t run promotions using the IPromotionEngine directly. So you can’t do _promotionEngine.Run(cart); you need to do call (IOrderGroup)cart.ApplyDiscounts(); Reason for this is that the PromotionEngine clears all the PromotionInformation objects from the OrderForm before starting to process promotions, so you’d lose your manual promotion if you’ve added it. What the extension method ApplyDiscounts does is that it will extract the manual promotions from the orderform, storing them safely. Then it will run the promotion engine and after it’s done will manually apply the manual promotions. This is quite quirky in my opinion and creates bugs like this one, but there you have it.