|
|
@@ -264,7 +264,7 @@ It is possible to establish dependency relationships between a PromotionAction a
|
|
|
For example, if we want to set up a "buy 1, get 1 free" offer, we need to:
|
|
|
|
|
|
1. Establish whether the Order contains the particular ProductVariant under offer (done in the PromotionCondition)
|
|
|
-2. Apply a discount to the qualifying OrderItem (done in the PromotionAction)
|
|
|
+2. Apply a discount to the qualifying OrderLine (done in the PromotionAction)
|
|
|
|
|
|
In this scenario, we would have to repeat the logic for checking the Order contents in _both_ the PromotionCondition _and_ the PromotionAction. Not only is this duplicated work for the server, it also means that setting up the promotion relies on the same parameters being input into the PromotionCondition and the PromotionAction.
|
|
|
|
|
|
@@ -285,7 +285,7 @@ export const buy1Get1FreeAction = new PromotionItemAction({
|
|
|
execute(ctx, orderLine, args, state) {
|
|
|
// highlight-next-line
|
|
|
const freeItemIds = state.buy_x_get_y_free.freeItemIds;
|
|
|
- if (idsContainsItem(freeItemIds, orderItem)) {
|
|
|
+ if (idsContainsItem(freeItemIds, orderLine)) {
|
|
|
const unitPrice = ctx.channel.pricesIncludeTax ? orderLine.unitPriceWithTax : orderLine.unitPrice;
|
|
|
return -unitPrice;
|
|
|
}
|