Try our conversational search powered by Generative AI!

Problem with combined promotions

Vote:
 

Hey!

When during the evaluationprocess of a promotion is it checked against other promotions to determine whether or not a promotion can not be combined with another promotion?

I have a problem where I have created a custom "SpendAmountGetDiscount" promotion with some extra conditions, but have an issue where CampaignA and CampaignB are both 
applied, despite being added to the "cannot be combined with.."-list. Below is a simplification of my issue:

SpendAmountCampaignA (spend 10 000kr, get 1 000kr discount)
SpendAmountCampaignB (spend 20 000kr, get 2 000kr discount)

And despite being disabled for combination, the user gets a 3000kr discount. I'm thinking there is something i have missed in my custom campaign, but can not find where.


#249073
Feb 23, 2021 16:04
Vote:
 

Hi Anton.

I'm assuming it is order level promotions. Just by looking at your problem, I don't know exactly where the issue is. But I can explain how the exclusions work in more detail, so maybe you can find the issue. Basically answering your first question.

The promotion engine is processing promotions in an ordered manner, the order that is reflected in the order and exclusions view in the UI. It also keeps track of which promotions that has already been processed with a reward that is fulfilled. It will also save all the exclusions for the promotions that have been applied and fulfilled.

So for each promotion that is eligible for evaluation, it will check:

  1. If the current promotion's excluded items (this promotion's value of "cannot be combined with") exists in the already applied promotions. If so, this promotion will be marked as excluded and won't be applied.
  2. If the accumulative list of excluded items from previously applied promotions contains this promotion (or campaign, or campaign root, anything in the hierarchy that includes this promotion). If so, this promotion will be marked as excluded and won't be applied.

If any of these two checks are true, it is excluded. If they are both false, this promotion will be added to the applied promotion and this promotion's excluded items will be added to the list of what is currently excluded, to be checked in the next promotion evaluation in the ordered list.

Hope this clarified a bit on how it works. There are more scenarios where a promotion would be excluded but they don't feel relevant. 

If my assumption is wrong, that you are indeed working with entry level discounts (i.e. SpendAmountGetItemDiscount) AND you have your exclusion level (a promotion engine setting) set to Unit, then you can get the 1000kr discount on 1 lineitem and the 2000kr discount on another lineitem, even if they are excluded from eachother. Because the exclusion will then operate on item level rather than the whole order.

#249080
Feb 23, 2021 16:47
Vote:
 

It is actually an entry level discount i am having issues with. Let me show you some pictures showing my problem and why i am confused.

            var rewardDescriptions = cart.ApplyDiscounts(promotionService, new PromotionEngineSettings() { ExclusionLevel = ExclusionLevel.Unit });

This line returns two RewardDescriptions. My two promotions that should not be combined, on one lineitem. Below is the image showing the exclusion of both promotions.

The custom promotion logic is as follows:

Spend X amount on Y products, get discount on Z products.

So i do have some custom conditions in my promotion. 

#249115
Feb 24, 2021 8:37
Vote:
 

That does indeed look fishy. 

Does it do the same if you instead of running 

cart.ApplyDiscounts(..)

You run

// IPromotionEngine from structuremap
_promotionEngine.Run(cart, new PromotionEngineSettings() { ExclusionLevel = ExclusionLevel.Unit });

?

It should be the same though... What is the type of `PromotionService`, is it something custom or is it simply the built in `PromotionEngine`?

#249119
Feb 24, 2021 8:44
Vote:
 

the promotionService is just the IPromotionEngine injected like this, so nothing custom.

IPromotionEngine promotionService = ServiceLocator.Current.GetInstance<IPromotionEngine>();

Replacing .ApplyDiscounts with .Run had the same result, returning two rewards:

#249121
Feb 24, 2021 8:54
Vote:
 

And if you look in the .Promotion.ExcludedItems for both these rewards, you still see that they both exclude All?

#249122
Feb 24, 2021 8:57
Vote:
 

Yes, they both have one item excluded, which im guessing is the "All" node.

#249124
Feb 24, 2021 9:00
Vote:
 

I'm grasping at straws here... But double check that 6329 is the same as SalesCampaignFolder.GetCampaignRoot(). Also maybe try with having them specifically exclude eachother as well? In the prioritization and exclusions view, have 20000 exclude 10000 and vice versa.

#249125
Feb 24, 2021 9:02
Vote:
 

Yeah, I realize i'm not giving you much to go on. Changing the exclusion to specificly exlude each other did no difference. I can also see that the correct ID is excluded for each promotion, despite that, two rewardDescriptions are returned when i run ApplyDiscounts()/Run()


And 2:

#249133
Feb 24, 2021 10:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.