Răsfoiți Sursa

docs(core): Minor correction and addition (#3251)

Marc Schipperheyn 1 an în urmă
părinte
comite
af59b36ee1
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      docs/docs/guides/core-concepts/promotions/index.md

+ 3 - 1
docs/docs/guides/core-concepts/promotions/index.md

@@ -268,6 +268,8 @@ For example, if we want to set up a "buy 1, get 1 free" offer, we need to:
 
 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.
 
+Note the use of `PromotionItemAction` to get a reference to the `OrderLine` as opposed to the `Order`.
+
 Instead, we can say that the PromotionAction _depends_ on the PromotionCondition:
 
 ```ts
@@ -280,7 +282,7 @@ export const buy1Get1FreeAction = new PromotionItemAction({
     args: {},
     // highlight-next-line
     conditions: [buyXGetYFreeCondition],
-    execute(ctx, orderItem, orderLine, args, state) {
+    execute(ctx, orderLine, args, state) {
         // highlight-next-line
         const freeItemIds = state.buy_x_get_y_free.freeItemIds;
         if (idsContainsItem(freeItemIds, orderItem)) {