November Happy Hour will be moved to Thursday December 5th.

Exclude specific catalog entries from a Promotion

Vote:
 

Hello everybody,

A customer I'm working on has for a while asked us to implement a feature where they can create a promotion, select which content they want to be the condition and then select some content that should not be a part of the promotion. I've not really theorized a solution for this, so we've done some workarounds that worked well enough to fulfill the use case they had. However, I want to reach out and see if someone can help me suggest a way of implementing this nicely.

Before anyone asks "Why not just include what should be included in the promotion?", I think I'm safe to say a very common usage of promotions is have one that affects the entire assortment or large portions of it, but that a few products are too "premium" to be affected by a discount.

Way 1: The obvious way

Create a custom promotion processor for the promotion. You can do whatever logic you want from in there, right? Well, this feature should be for all promotions, so that'd mean we'd have to create a custom promotion for every existing built in promotion. A class that inherits the data class for that specific promotion adding the list of exluded content and a processor that overrides the old promotion processor and somewhere injects the logic to exclude the products selected in the list of excluded content. 

So in the end the solution is quite ugly, will have to mean creating tons of code that "already existed" and if Epi releases a new promotion implementation, we will have to manually build that one as well.

Way 2: EntryFilterSettings to our rescue?

The fairly new way of excluding products from promotions, does look very promising, just by looking at the description. However it doesn't fit this use case, as this should be promotion specific. Maybe promotion A should exclude product P1 and promotion B should exclude P2. We can't solve that by the EntryFilterSettings, since that one is used in the promotion engine, removing the items before the engine starts running the specific promotion processors.

So this method is unfortunately a no-go. Even though we do use EntryFilterSettings for a lot of other purposes, such as always excluding gift cards from promotions!

Way 3: Make Epi implement a way!

innocent

In all seriousness I'm looking for a way of implementing this. Am I missing something, am I tunneled visioned and there is an super easy way of achieving this? Currently I'm leaning to implementing it as Way 1, but not super excited about it. 

#185419
Edited, Nov 18, 2017 11:31
Vote:
 

What are you doing in a nice Saturday morning, Joel? :)

There is no easy way to do that - I just went and check the source code (what am I doing as well?) - and there is no "framework" way for doing that. But the point of the promotion engine is to be extensible. You can extend your PromotionData to add some "ExcludedEntries" property, and handle that in your processor.

#185420
Nov 18, 2017 12:01
Vote:
 

Yeah exactly, that'd be the "Way 1" of doing it, but applying that to all built in promotions would mean create one custom promotion for each built in one..

I'm currently working from Avensias office in Philippines. A combination of being quite alone at "home" and being sick leads me to my computer! :P

#185421
Edited, Nov 18, 2017 12:51
Vote:
 

Haha.

I think the entry filter-thingy was actually made to fulfill a request from you ;) - if the requirement was more clear at the beginning, we would have something by now :)

However that does not mean we won't do anything about that - I'll create a story so we can look into it. However it will have to compete with other (high priority) stories in our backlog. But you already know how to boost its priority. 

#185422
Nov 18, 2017 13:14
Vote:
 

Yeah I know about the entry filter, it was so we could find a framework way to exclude giftcards from promotions. I don't think we've officially asked for this specific feature before however, as they differ a bit. I wouldn't want to have this feature instead of entry filter when it comes to not running promotions on gift cards for example :)

Thanks for answering, anyways. I'll probably build a custom representation of all built in promotions for now, using as much epi code as I can. I have a faint memory that someone said that it should be done and in production before black friday, but I hope I heard wrong! embarassed

#185423
Nov 18, 2017 13:19
Vote:
 

Joel, Quan, did you ever come up with a better solution to this problem than having to build custom representations of all built in promotions? In my case I'd like to exclude certain articles from Entry- and OrderPromotions but not from ShippingPromotions. 

#200510
Jan 14, 2019 16:54
Vote:
 

No we at episerver haven't had time to tackle this yet

#200583
Jan 16, 2019 20:16
Vote:
 

I'll look into this, the technical part would be fairly easy, the non technical part (how to convince my colleagues to accept the changes) is much more challenging. But, let's see 

#200620
Jan 17, 2019 14:33
Vote:
 

An update - because I know you like updates - I was able to make it works, both at UI and API level. The product manager is happy with it so it's probably happening. It still needs polishing, but there is a chance that we are going to make it in Commerce 13 

#200647
Jan 18, 2019 16:43
Vote:
 

The changes are in, it'll be available in Commerce 13 

#200999
Feb 01, 2019 11:10
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.