What Evaluate does is to create an in memory order group with one item and with quantity = 1.0m and use the promotion engine to see which promotions can be applied. You can do the same with different quantity. Yes InMemoryOrderGroup is in an internal namespace so remember it might be changed without a major version
Hi Quan, thanks for responding
How do I pass quantity to the IPromotionEngine.Evaluate method ? Can you please provide a code example
Thanks
When you have an order group you can just call Run, but with this setting
new PromotionEngineSettings() { ApplyReward = false, RequestedStatuses = requestFulfillmentStatus };
Not ideal that InMemoryOrderGroup is intended for internal use only but seems the only way to preview applicable promotions with quantity conditions
Quan, is there any performance concerns by calling Run for individual SKUs on a listing page to preview discount prices ?
Thanks
I'm glad you asked. It should not be worse than you run Evaluate, the actual question is if you have any heavy promotion processor. If all of your processors are fast, then it should not be a problem. (still CPU heavy, but not that bad)
Commerce 12.8
I have a scenario where I have long running item promotions e.g.
Buy at least 3 items and get 25% off
On the website page I need to list all the SKUs with the default unit price and the discounted unit price when buying 3+ items
What's the best (and simplest) way to get the discounted price from the PromotionEngine in this case ? The IPromotionEngine interface doesn't accept quantity as a parameter to preload the discount prices
Thanks