I've simplified my scenario as there will be lots of discounts created via the api and I think trying to manage priority across all won't be possible.
So let me rephrase it: you want to have multiple/many promotions, but always only one promotion with best discount is applied? Is it per order or per item?
Then it would be very very tricky to do. If you want to have it per order - then what you can do is to use Evaluate to find out which promotion gives the best discount and then apply that. When it comes to per item ... One half-baked way to do is to call Evaluate on each item to find out which promotion is the best. However, that will not work with some discounts like "Buy $100 get 20% discount on selected items".
TL;DR: your requirement is very unique and I'm afraid it can not be done easily (if at all) with the promotion system.
Ok thanks for the feedback Quan. I've put in place some code to set the priority when discounst are created, will have to see how that goes as we get into more real world testing.
Commerce version 12.5.0
Hi All,
I thought that when retrieving discount prices the best price was retrieved first if multiple discounts were valid.
For example. I have two discounts, one where a 15% discount is applied when the logged in user is within a "staff" role (setup via a visitor group) and another discount which is just 20% across all categories. These are both setup so they can't be combined. The 15% is currently set as higher priority.
I would have expected that since 20% is a better price this is retrieved, however that doesn't appear to be the case, 15% is.
When I call "GetDiscountedPrices" I only see the 15% price, however if I remove the "Combined" setting and call again I see both prices (so I can order these and get the lowest first), however the 15% is applied and then the 20% is applied on top so the price isn't correct.
Is there a way around this behaviour?
I've seen some related discussion on https://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=187959&pageIndex=1
Thanks
Mark