Răsfoiți Sursa

docs: Fix free gift action example

Michael Bromley 3 ani în urmă
părinte
comite
998daba24c
1 a modificat fișierele cu 3 adăugiri și 1 ștergeri
  1. 3 1
      docs/content/developer-guide/promotions.md

+ 3 - 1
docs/content/developer-guide/promotions.md

@@ -190,7 +190,9 @@ export const freeGiftAction = new PromotionItemAction({
     // This part is responsible for ensuring the variants marked as 
     // This part is responsible for ensuring the variants marked as 
     // "free gifts" have their price reduced to zero.  
     // "free gifts" have their price reduced to zero.  
     if (lineContainsIds(args.productVariantIds, orderLine)) {
     if (lineContainsIds(args.productVariantIds, orderLine)) {
-      const unitPrice = orderLine.unitPrice;
+      const unitPrice = orderLine.productVariant.listPriceIncludesTax
+        ? orderLine.unitPriceWithTax
+        : orderLine.unitPrice;
       return -unitPrice;
       return -unitPrice;
     }
     }
     return 0;
     return 0;