A critical vulnerability was discovered in React Server Components (Next.js). Our Systems Remain Fully Protected. Learn More.
AI OnAI Off
A critical vulnerability was discovered in React Server Components (Next.js). Our Systems Remain Fully Protected. Learn More.
In trying to extend the standard set of promotions to create a discount of the form Buy any combination of 'n' items from a set of potential items 'X' and recieve a percentage discount 'p' off the cheapest 'm' items from a set of potential items 'Y'. This is a basic multi-buy promo.
From looking at the blog posts short-brief-about-custom-promotions and Custom-promotion-development in conjunction with examining the expressions from the built in discounts and those created when building your own from commerce manager I cannot see a way to choose a target from a collection serialised in the settings object. It appears the easiest way to do this or similarly complex filters\conditionals would be to add a new method to the RulesContext class. As I understand it this would expose the methods from the 'this' instance in the ExpressionEditor. The documentation for RulesContext implies this is possible.
However from the decompiled code I can see that a custom RulesContext cannot be injected and it appears the only way to do this would be to replace RulesExprValidator (via the market config) and reimplement the Eval method loading an extended RulesContext instance.
I was hoping someone could confirm this understanding or if its incorrect point me at an appropriate blog or documentation page.
Andrew