@zoxllc/shopify-checkout-extensions 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,11 @@ export interface Tier {
24
24
  * - stackTiers: false - Applies ONLY the highest qualifying tier
25
25
  * Example: Spend $150 → Get product from $100 tier only
26
26
  *
27
+ * Subtotal Calculation:
28
+ * - Automatically excludes items tagged with excludeGiftTags
29
+ * - Automatically excludes tier reward products (by ID or tag)
30
+ * This prevents gaming the system by manually adding gift products
31
+ *
27
32
  * Use cases:
28
33
  * - Cumulative GWP: Spend more, get more gifts (stackTiers: true)
29
34
  * - Bundle upgrades: Spend more, get better bundle (stackTiers: false)
@@ -1 +1 @@
1
- {"version":3,"file":"MultiTierDiscount.d.ts","sourceRoot":"","sources":["../../src/lineItem/MultiTierDiscount.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACV,iBAAiB,EACjB,SAAS,EACV,MAAM,qBAAqB,CAAC;AAE7B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,WAAW,IAAI;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,iBAAkB,SAAQ,QAAQ;IAC7C,KA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AAE,IAAI,EAAE,CAAC;IACd,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,OAAO,CAAC;gBAGlB,QAAQ,EAAE,iBAAiB,EAC3B,UAAU,EAAE,CAAC,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC,EAClD,KAAK,EAAE,IAAI,EAAE,EACb,eAAe,GAAE,MAAM,EAA0B,EACjD,UAAU,GAAE,OAAc;IAU5B;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAyD7B;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAI3B;;OAEG;IACH,OAAO,CAAC,sBAAsB;IA+B9B,GAAG,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY;CAqF9C"}
@@ -14,6 +14,11 @@ const Campaign_1 = require("../common/Campaign");
14
14
  * - stackTiers: false - Applies ONLY the highest qualifying tier
15
15
  * Example: Spend $150 → Get product from $100 tier only
16
16
  *
17
+ * Subtotal Calculation:
18
+ * - Automatically excludes items tagged with excludeGiftTags
19
+ * - Automatically excludes tier reward products (by ID or tag)
20
+ * This prevents gaming the system by manually adding gift products
21
+ *
17
22
  * Use cases:
18
23
  * - Cumulative GWP: Spend more, get more gifts (stackTiers: true)
19
24
  * - Bundle upgrades: Spend more, get better bundle (stackTiers: false)
@@ -42,6 +47,24 @@ class MultiTierDiscount extends Campaign_1.Campaign {
42
47
  const variant = line.merchandise;
43
48
  // Check if product has any of the exclude tags
44
49
  isExcludedGift = this.excludeGiftTags.some(tag => variant.product.hasTags.filter((t) => t.hasTag && t.tag === tag).length > 0);
50
+ // Also exclude if this product is a tier reward product
51
+ // This prevents gaming the system by manually adding gift products
52
+ if (!isExcludedGift) {
53
+ const productId = variant.product.id.split('/').pop();
54
+ isExcludedGift = this.tiers.some(tier => {
55
+ // Check if product ID matches any tier's gift products
56
+ if (tier.productIds && tier.productIds.length > 0) {
57
+ if (tier.productIds.includes(productId || '')) {
58
+ return true;
59
+ }
60
+ }
61
+ // Check if product tags match any tier's gift product tags
62
+ if (tier.productTags && tier.productTags.length > 0) {
63
+ return tier.productTags.some((tag) => variant.product.hasTags.filter((t) => t.hasTag && t.tag === tag).length > 0);
64
+ }
65
+ return false;
66
+ });
67
+ }
45
68
  }
46
69
  if (isExcludedGift) {
47
70
  continue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zoxllc/shopify-checkout-extensions",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Configuration-driven runtime engine for Shopify checkout extensions - campaigns, discounts, qualifiers, and selectors",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",