Introduction to Promotions
Our promotion engine is stooled upon the idea that we want to give our customers the best possible combination of available discounts, providing them with the best possible price in the end. Not because we always want customers to pay the least possible amount, but because they will find a way to pay the least amount of money anyways. Customers have proven to be incredibly ingenious in splitting and composing orders in ways that benefit their wallet. We don't want customers to feel the need to do this, so we do it for them.
The EVA promotion engine consists of one or more layers. These layers can house a bunch of discounts. The basic premise is that these layers form a hierarchy of some sorts, telling EVA how to handle discount calculations.
Basically, how it works is; as soon as an order or basket is created/updated/changed, the promotion engine starts the calculation process. This process is as follows:
Calculations start in the first layer. EVA will calculate which (combination of) discount(s) result in the best discount for the customer. Discounts within a layer can only be combined if they don't bite each other, which means that discounts can only be combined if they apply to specific, different products. Discounts that apply to the entire order can never be combined within a layer.
After calculating the best discount possible within layer one, EVA stores this discount and moves on to the next layer. The next layer basically serves as a clean slate where the same process takes place as we saw in the first layer, which results in a second best possible discount which is also stored.
After walking through all layers, we are left with a combination of layer outcomes, which are then added up, resulting in the final layer-based discount amount, which can look something like this:
As a last hurdle, this cumulative discount amount is compared to all available exclusive discounts, which are discounts that exclude all other discounts upon application.
After this final comparison, the final, conclusive discount amount is applied to the order(lines). Adding or removing items from the basket triggers the calculation all over again since this changes possible outcomes.