@wix/agent-skills 1.12.0 → 1.14.0

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.
Files changed (44) hide show
  1. package/README.md +4 -0
  2. package/package.json +1 -1
  3. package/skills/wix-app/references/data-collection/WIX_DATA.md +10 -0
  4. package/skills/wix-design-system/SKILL.md +3 -1
  5. package/skills/wix-headless/references/BUILD-astro.md +10 -1
  6. package/skills/wix-headless/references/shared/STYLING.md +0 -1
  7. package/skills/wix-headless/scripts/compose.mjs +19 -24
  8. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +15 -9
  9. package/skills/wix-manage/SKILL.md +32 -54
  10. package/skills/wix-manage/references/ecommerce/api-recommendation-tracking.md +3 -2
  11. package/skills/wix-manage/references/ecommerce/ecom-load-context.md +144 -0
  12. package/skills/wix-manage/references/ecommerce/ecom-pricing.md +84 -0
  13. package/skills/wix-manage/references/ecommerce/ecom-shipping.md +64 -0
  14. package/skills/wix-manage/references/ecommerce/{setup-coupons.md → pricing-promotions/ecom-pricing-create-coupon.md} +20 -6
  15. package/skills/wix-manage/references/ecommerce/{setup-discount-rules.md → pricing-promotions/ecom-pricing-create-discount-rule.md} +31 -1
  16. package/skills/wix-manage/references/ecommerce/{flow-bundle-and-save.md → pricing-promotions/ecom-pricing-flow-bundle-and-save.md} +11 -52
  17. package/skills/wix-manage/references/ecommerce/{flow-seasonal-promotion.md → pricing-promotions/ecom-pricing-flow-seasonal-promotion.md} +17 -57
  18. package/skills/wix-manage/references/ecommerce/{flow-stock-mover.md → pricing-promotions/ecom-pricing-flow-stock-mover.md} +28 -70
  19. package/skills/wix-manage/references/ecommerce/{flow-upsell-boost.md → pricing-promotions/ecom-pricing-flow-upsell-boost.md} +15 -68
  20. package/skills/wix-manage/references/ecommerce/{goal-clear-inventory.md → pricing-promotions/ecom-pricing-goal-clear-inventory.md} +22 -13
  21. package/skills/wix-manage/references/ecommerce/{goal-drive-cross-sells.md → pricing-promotions/ecom-pricing-goal-drive-cross-sells.md} +26 -8
  22. package/skills/wix-manage/references/ecommerce/{goal-increase-aov.md → pricing-promotions/ecom-pricing-goal-increase-aov.md} +32 -25
  23. package/skills/wix-manage/references/ecommerce/{goal-seasonal-revenue.md → pricing-promotions/ecom-pricing-goal-seasonal-revenue.md} +21 -8
  24. package/skills/wix-manage/references/ecommerce/{troubleshoot-discount-not-applying.md → pricing-promotions/ecom-pricing-troubleshoot-not-applying.md} +1 -1
  25. package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +23 -47
  26. package/skills/wix-manage/references/ecommerce/{api-shipping.md → shipping/ecom-shipping-api.md} +4 -3
  27. package/skills/wix-manage/references/ecommerce/{flow-fix-coverage-gaps.md → shipping/ecom-shipping-fix-coverage.md} +23 -17
  28. package/skills/wix-manage/references/ecommerce/{flow-add-free-shipping.md → shipping/ecom-shipping-free-shipping.md} +23 -18
  29. package/skills/wix-manage/references/ecommerce/{flow-optimize-shipping-rates.md → shipping/ecom-shipping-optimize-rates.md} +19 -16
  30. package/skills/wix-manage/references/ecommerce/{setup-store-pickup-location.md → shipping/ecom-shipping-setup-pickup.md} +12 -10
  31. package/skills/wix-manage/references/ecommerce/{setup-shipping-rates.md → shipping/ecom-shipping-setup-rates.md} +1 -2
  32. package/skills/wix-manage/references/ecommerce/{setup-shipping-regions.md → shipping/ecom-shipping-setup-regions.md} +1 -2
  33. package/skills/wix-manage/references/sites/query-sites.md +104 -32
  34. package/skills/wix-headless/references/astro/templates/Footer.astro +0 -27
  35. package/skills/wix-headless/references/astro/templates/Navigation.astro +0 -38
  36. package/skills/wix-headless/references/astro/templates/index.astro +0 -56
  37. package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +0 -147
  38. package/skills/wix-manage/references/ecommerce/guardrail-discount-conflicts.md +0 -118
  39. package/skills/wix-manage/references/ecommerce/guardrail-margin-protection.md +0 -88
  40. package/skills/wix-manage/references/ecommerce/guardrail-rate-pricing-sanity.md +0 -108
  41. package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +0 -124
  42. package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +0 -298
  43. package/skills/wix-manage/references/ecommerce/skill-graph.md +0 -139
  44. package/skills/wix-manage/references/ecommerce/troubleshoot-checkout-delivery-dropoff.md +0 -124
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: "Shipping"
3
+ description: Shipping-setup boundary owner for an eCommerce store. **Always load this dispatcher first whenever a question touches shipping setup** — rates, regions, pickup, free-shipping thresholds, and diagnosing wrong/missing shipping. Order fulfillment (mark shipped, tracking, labels, invoices) is currently handled outside the routing tree.
4
+ ---
5
+
6
+ # Shipping
7
+
8
+ Set up and tune how a store ships — what rates to charge, which regions are covered, pickup/local-delivery options, free-shipping thresholds, and diagnosing wrong or missing shipping at checkout.
9
+
10
+ > **Routing rule (READ FIRST).** This dispatcher owns shipping *setup* — rates, regions, pickup, free-shipping thresholds, and diagnosing wrong/missing shipping at checkout. Post-purchase / order-execution work (mark shipped, update tracking, partial/bulk fulfill, shipping labels, packing slips, invoices, "find unshipped orders") is not yet in the routing tree — fall back to the relevant API docs or Dashboard guidance for those.
11
+
12
+ **Shipping is NOT:**
13
+ - Tax on shipping or destination tax → tax APIs / Dashboard.
14
+ - The checkout/delivery step conversion itself → see **Checkout & cart**.
15
+ - Marking orders fulfilled, updating tracking, bulk fulfillment, invoices, or shipping labels → not covered here; use the Order Fulfillments API directly or the Wix Dashboard.
16
+ - Order lifecycle (approve/cancel/search an order), refunds/payments → existing Get Paid/payment docs or Dashboard guidance.
17
+
18
+ > **Before dispatching** — confirm MerchantContext is loaded. If `siteData.country` is not in your conversation context, load it via [Load Merchant Context](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/e-commerce-load-context). Skip if already loaded.
19
+ >
20
+ > **Promotion dispatch.** Score each entry below by (a) the merchant's query → `intent:*` tags, (b) MerchantContext → context tags. Load the **highest-scoring** entry with `ReadFullDocsArticle`. Ties → highest `priority`. No match → follow the base recipe at the bottom.
21
+ >
22
+ > **Do not fall back to legacy `flow-*` slugs.** The skills below replaced earlier `…/skills/flow-<name>` articles (e.g. `flow-add-free-shipping`) during the routing-tree migration. If a slug below returns a transient 404 from the docs backend (rawdocs ingestion delay on a freshly-renamed slug), **retry the same URL after a brief pause** — do NOT load the legacy `flow-*` version, which carries stale pre-migration content that contradicts this dispatcher.
23
+ >
24
+ > **API reference.** All shipping endpoints (Shipping Options + Delivery Profiles) are documented inline in [Shipping API Reference](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/shipping-api-reference) — there is no public `dev.wix.com` docs page for them, so that file is the authoritative spec. The recipes below link to it where needed.
25
+ >
26
+ > **Routing rule:** After identifying the matching skill above, call `ReadFullDocsArticle` on it BEFORE making any API calls or offering a configuration. The exact endpoint shapes, field names, and guardrails live in the recipe — do not configure shipping from training knowledge alone. If the URL returns a 404, retry once; then try the next-best match from the list above.
27
+
28
+ ### Actions — set up shipping
29
+
30
+ > - [Set up shipping rates / rules](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/shipping-set-up-rates) — tags: `[intent:setup-rates]` · priority 0
31
+ > - [Set up delivery regions / coverage](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/shipping-set-up-regions) — tags: `[intent:setup-regions]` · priority 0
32
+ > - [Set up store pickup / local delivery](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/shipping-set-up-pickup-local-delivery) — tags: `[intent:setup-pickup]` · priority 0
33
+ > - [Add free shipping over $X](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/shipping-add-free-shipping) — tags: `[intent:free-shipping]` · priority 0
34
+
35
+ ### Optimize & fix
36
+
37
+ > - [Optimize shipping rates (flat ↔ tiered, gaps)](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/shipping-optimize-rates) — tags: `[intent:optimize-rates]` · priority 0
38
+ > - [Fix coverage gaps (regions with no shipping option)](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/shipping-fix-coverage-gaps) — tags: `[intent:fix-coverage]` · priority 0
39
+
40
+ ### Troubleshoot
41
+
42
+ > - [Shipping rate incorrect (customer charged wrong shipping)](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/shipping-optimize-rates) — tags: `[intent:rate-incorrect]` · priority 0 · *audit rates via the Rate Pricing Sanity guardrail, then correct the rate structure*
43
+
44
+ ## Tag matching
45
+
46
+ The agent matches the merchant's natural-language query to an `intent:*` tag (cues are in each file's `description`), AND matches MerchantContext to any context tags (e.g. `country`, `region`). All of an entry's tags must be satisfied for it to be eligible; highest tag-count wins; ties → `priority`.
47
+
48
+ ### Worked examples
49
+
50
+ | Merchant query | MerchantContext | Match |
51
+ |---|---|---|
52
+ | "Set up free shipping over $50" | any | `ecom-shipping-free-shipping` via `[intent:free-shipping]` |
53
+ | "How much should I charge for shipping?" | any | `ecom-shipping-setup-rates` via `[intent:setup-rates]` |
54
+ | "I want customers to pick up from my shop" | any | `ecom-shipping-setup-pickup` via `[intent:setup-pickup]` |
55
+ | "Some regions have no shipping option" | any | `ecom-shipping-fix-coverage` via `[intent:fix-coverage]` |
56
+ | "A customer was charged the wrong shipping" | any | `ecom-shipping-optimize-rates` via `[intent:rate-incorrect]` (runs rate-sanity guardrail first) |
57
+
58
+ ## Base recipe (fallback)
59
+
60
+ If nothing matches, the merchant's intent is unclear. Ask **one** clarifying question:
61
+
62
+ > "Do you want to **set up** shipping (rates, regions, or pickup), **add free shipping**, **optimize** your existing rates, or **fix** a region with no shipping option?"
63
+
64
+ Map the answer to one of the `intent:*` tags above and re-dispatch. Order-fulfillment requests fall outside this dispatcher — use the Order Fulfillments API or Wix Dashboard.
@@ -1,9 +1,10 @@
1
1
  ---
2
- name: "Setup: Coupons"
3
- description: Creates and manages coupon codes using the Coupons V2 API. Covers coupon types (percentage, fixed amount, fixed price, free shipping), scope targeting, usage limits, and the mapping from discount recommendations to coupon API payloads.
4
- layer: config
2
+ name: "Pricing: Create Coupon"
3
+ description: "PREFERRED recipe for converting a COUPON recommendation (mechanism: COUPON) into a Wix coupon. Use THIS entry — NOT the legacy setup-coupons entry which is superseded. Maps scope/discountType/conditions to Coupons V2 API fields."
5
4
  ---
6
- # Setup Coupons
5
+ # Pricing: Create Coupon
6
+
7
+ > **This skill is the single source for coupon creation.** Do NOT load `…/skills/setup-coupons` — that legacy slug pre-dates the routing tree migration and its content has been merged into this file. If the WixREADME index surfaces it, ignore it.
7
8
 
8
9
  ## Prerequisites
9
10
 
@@ -22,7 +23,7 @@ layer: config
22
23
 
23
24
  Before creating a coupon, check for code conflicts and existing promotions on the same scope.
24
25
 
25
- **Endpoint**: `POST https://www.wixapis.com/v2/coupons/query`
26
+ **Endpoint**: `POST https://www.wixapis.com/stores/v2/coupons/query`
26
27
 
27
28
  **Request**:
28
29
  ```json
@@ -66,11 +67,21 @@ Before creating a coupon, check for code conflicts and existing promotions on th
66
67
 
67
68
  Check for: duplicate codes, overlapping scopes with active coupons, and cross-mechanism stacking with active automatic discount rules.
68
69
 
70
+ ### Guardrails — run before creating the coupon
71
+
72
+ - **Duplicate / conflicting code** — reject a code already in use.
73
+ - **Cross-mechanism stacking** — coupons stack with automatic discount rules at checkout. Query active discount rules on overlapping scope; if found, warn with the combined effective discount ("a 20% coupon during a 20% automatic sale = ~36% off"). Only one coupon applies per checkout, but automatic rules are unlimited.
74
+ - **% sanity** — > 50% warn (show a $100 → $(100−pct) example); = 100% block unless confirmed; > 100% always block.
75
+ - **Margin** — if cost data is available, ensure the discount doesn't push price below cost; otherwise warn for > 40%.
76
+ - **User override** — explicit merchant values override these caps; document the override in your reasoning.
77
+
78
+ (The automatic-rule side of these checks lives in [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) → "Guardrails".)
79
+
69
80
  ---
70
81
 
71
82
  ## Step 2: Create a percentage-off coupon
72
83
 
73
- **Endpoint**: `POST https://www.wixapis.com/v2/coupons`
84
+ **Endpoint**: `POST https://www.wixapis.com/stores/v2/coupons`
74
85
 
75
86
  **Request** — 15% off all store products:
76
87
  ```json
@@ -215,6 +226,8 @@ Instead of targeting a scope, you can require a minimum cart subtotal. This is a
215
226
  | Free shipping | `freeShipping` | Boolean `true` | `"freeShipping": true` |
216
227
  | Buy X Get Y | `buyXGetY` | Object with `x` and `y` fields | `"buyXGetY": {"x": 2, "y": 1}` |
217
228
 
229
+ > **Note**: Free shipping as an **automatic discount rule** is NOT supported — use the `freeShipping` coupon type here, or configure a free-shipping rate via the Shipping Options API.
230
+
218
231
  ## Scope values for Wix Stores
219
232
 
220
233
  | Scope target | `namespace` | `group.name` | `group.entityId` |
@@ -327,6 +340,7 @@ When the recommendation output has `mechanism: "COUPON"`, use this mapping to co
327
340
 
328
341
  | Error | Cause | Fix |
329
342
  |---|---|---|
343
+ | `"When scope or minimumSubtotal is not used - only FreeShipping coupon is allowed"` | Coupon sent without `scope` or `minimumSubtotal` | Add `scope: { "namespace": "stores", "group": { "name": "product" } }` for site-wide, or set `minimumSubtotal` |
330
344
  | Duplicate code | Another coupon uses the same code | Generate a different code |
331
345
  | Invalid startTime | Value too low (must be epoch ms, not seconds) | Multiply by 1000 if in seconds |
332
346
  | Both scope and minimumSubtotal set | These are oneOf — cannot use both | Choose scope OR minimumSubtotal |
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: "Setup: Discount Rules"
2
+ name: "Pricing: Create Discount Rule"
3
3
  description: Configures automatic discount rules using the eCommerce Discount Rules API. Covers percentage and fixed-amount discounts, scope targeting (catalog-wide, specific collections, or individual products), scheduling active periods, and the find-by-name + update pattern.
4
4
  layer: config
5
5
  ---
@@ -126,6 +126,36 @@ Note existing rules and their scopes to avoid stacking conflicts.
126
126
 
127
127
  ---
128
128
 
129
+ ## Guardrails — run before creating or updating any discount
130
+
131
+ These checks guard every discount creation (rule **or** coupon). Run them before the create/update calls below. **User input overrides all caps** — if the merchant explicitly asks for a value beyond a threshold, honor it and document the override in your reasoning.
132
+
133
+ **Conflict / stacking** (uses the Step 1 query of active rules; for coupons, also query active coupons):
134
+ - **Same-scope overlap** — a new rule conflicts with an existing active rule when scopes overlap (both `CATALOG`; `CATALOG` vs `COLLECTION`; same `COLLECTION`/`SPECIFIC_PRODUCTS` id). Wix stacks automatic rules → warn and offer to deactivate the existing one.
135
+ - **Time overlap** — overlapping `activeTimeInfo` on the same scope (`existingStart < newEnd AND existingEnd > newStart`) → warn about the overlap window.
136
+ - **Cross-mechanism (automatic + coupon)** — automatic discounts and coupons both apply at checkout. If creating a rule, query active coupons on overlapping scope (and vice-versa); warn with the combined effective discount. (Only one coupon per checkout, but automatic rules are unlimited.)
137
+
138
+ **Margin / sanity:**
139
+ - **Global cap** — default max discount **25%**; flag anything higher (proceed only on explicit request).
140
+ - **Minimum margin** — default floor **15%**; if cost data is available, `effective_margin = (price − cost − discount_amount) / price × 100` must stay ≥ 15% (block + explain otherwise).
141
+ - **% sanity** — > 50% warn (show a $100 → $(100−pct) example); = 100% block unless confirmed ("makes the product free"); > 100% always block.
142
+ - **Stacking margin** — when a new discount overlaps existing active ones, evaluate the *combined* discount against the cap and margin floor, not just the new one in isolation.
143
+
144
+ | Scenario | Action |
145
+ |---|---|
146
+ | Discount ≤ 25% and margin ≥ 15%, no scope overlap | Proceed |
147
+ | Scope/time/cross-mechanism overlap | Warn; offer to deactivate existing or confirm stacking |
148
+ | Discount 26–50% (no override) | Warn, ask to confirm |
149
+ | Discount > 50% | Warn with $ example, confirm |
150
+ | Discount = 100% | Block unless confirmed |
151
+ | Discount > 100% | Block always |
152
+ | Combined/stacked discount exceeds cap or margin floor | Warn about cumulative effect |
153
+ | Any threshold, explicit user override | Proceed, document the override in reasoning |
154
+
155
+ When a discount *isn't* applying as expected, see [Troubleshoot: Discount Not Applying](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-discount-not-applying).
156
+
157
+ ---
158
+
129
159
  ## Step 2: Create a percentage discount rule
130
160
 
131
161
  **Endpoint**: `POST https://www.wixapis.com/ecom/v1/discount-rules`
@@ -1,28 +1,16 @@
1
1
  ---
2
2
  name: "Flow: Bundle and Save"
3
- description: Creates a discount campaign promoting product discovery and cross-selling by requiring minimum item quantities. Targets high-margin categories with complementary products.
4
- layer: flow
5
- references:
6
- - name: "Guardrail: Discount Conflicts"
7
- path: ecommerce/guardrail-discount-conflicts.md
8
- load: true
9
- - name: "Setup: Discount Rules"
10
- path: ecommerce/setup-discount-rules.md
11
- load: true
3
+ description: BUNDLE_AND_SAVE sub-flow — load [Goal: Drive Cross-Sells] FIRST (it owns classification and routing); this is a sub-step, NOT a direct entry from README.
12
4
  ---
13
5
  # Flow: Bundle & Save Campaign
14
6
 
15
- > **Before executing this skill**, read these referenced skills with `ReadFullDocsArticle`:
16
- > - [Guardrail: Discount Conflicts](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/guardrail-discount-conflicts)
17
- > - [Setup: Discount Rules](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/setup-discount-rules)
7
+ > **Before executing this skill**, read [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) with `ReadFullDocsArticle` — it contains the discount-rule mechanics **and** the pre-create guardrails (conflict/stacking, margin floor, %-sanity).
18
8
 
19
9
  Creates a discount that rewards customers for purchasing multiple items, encouraging product discovery and cross-selling. The discount activates when the cart contains a minimum number of items, and targets categories or products where bundling makes strategic sense.
20
10
 
21
11
  ## Prerequisites
22
12
 
23
- - Wix Stores installed on the site
24
- - Products exist in the catalog across multiple categories
25
- - Access to `getCatalogAnalytics` and `getProductCatalogData` tools
13
+ - Products exist in the catalog across multiple categories (`siteData.hasCatalog === true`, checked at context load)
26
14
  - Categories with 2+ products suitable for bundling
27
15
 
28
16
  ## Required APIs
@@ -32,25 +20,18 @@ Creates a discount that rewards customers for purchasing multiple items, encoura
32
20
 
33
21
  ---
34
22
 
35
- ## Step 1: Gather catalog data
23
+ ## Step 1: Use pre-loaded catalog data
36
24
 
37
- Call `getCatalogAnalytics` and `getProductCatalogData` concurrently to assess the catalog's bundle potential.
25
+ Catalog analytics and product data are already in conversation context — do NOT re-fetch:
38
26
 
39
- **getCatalogAnalytics** call:
40
- ```
41
- aggregates: min(price), max(price), avg(profitMargin), count
42
- ```
43
-
44
- **getProductCatalogData** call:
45
- ```
46
- ordered: price DESC, ordersCount DESC
47
- ```
27
+ - `siteData.catalogAnalytics` — category groups with `min(price)`, `max(price)`, `avg(profitMargin)`, `count()`. Loaded by the eCommerce Load Context.
28
+ - `siteData.productCatalogData` — per-product list sorted `price DESC, ordersCount DESC` for BUNDLE_AND_SAVE goal. Loaded by the run-a-sale orchestrator Step 5.
48
29
 
49
- Save the following values:
50
- - `min_price`, `max_price` — price range determines viable bundle combinations
30
+ Extract the following from context:
31
+ - `min_price`, `max_price` — from the "All Products" group in `siteData.catalogAnalytics`
51
32
  - `avg_profit_margin` — sets the discount ceiling
52
33
  - `count` — catalog breadth; more products = more bundling options
53
- - Top products by price and order count — identifies popular items for bundle anchoring
34
+ - Top products by price and order count — from `siteData.productCatalogData`
54
35
 
55
36
  ---
56
37
 
@@ -118,29 +99,7 @@ If scope is CATEGORY, call `getCategoryIds` to convert category names to GUIDs.
118
99
 
119
100
  ## Step 7: Run guardrail checks
120
101
 
121
- **Run the Guardrail: Discount Conflicts checks before creating the rule.**
122
-
123
- 1. Query existing active discount rules:
124
-
125
- **Endpoint**: `POST https://www.wixapis.com/ecom/v1/discount-rules/query`
126
-
127
- **Request**:
128
- ```json
129
- {
130
- "query": {
131
- "filter": {
132
- "active": true
133
- },
134
- "paging": {
135
- "limit": 100
136
- }
137
- }
138
- }
139
- ```
140
-
141
- 2. Check for scope overlap with existing rules. Bundle discounts are especially prone to stacking — a customer buying 3 items in a category with both a bundle discount and a catalog-wide sale would get both.
142
- 3. Check for coupon stacking risks.
143
- 4. If conflicts found, present to merchant and get confirmation.
102
+ **Run the pre-create guardrails in [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) → "Guardrails" before creating the rule.** Bundle discounts are especially prone to **scope-overlap stacking** (a customer buying 3 items in a category with both a bundle discount and a catalog-wide sale gets both) and **coupon stacking** — present any conflicts to the merchant and confirm.
144
103
 
145
104
  ---
146
105
 
@@ -1,30 +1,22 @@
1
1
  ---
2
2
  name: "Flow: Seasonal Promotion"
3
- description: Creates event-driven promotional campaigns tied to holidays or seasonal events. Uses country and date context to identify upcoming events, calculates optimal campaign windows, and targets relevant categories.
4
- layer: flow
5
- references:
6
- - name: "Guardrail: Discount Conflicts"
7
- path: ecommerce/guardrail-discount-conflicts.md
8
- load: true
9
- - name: "Setup: Discount Rules"
10
- path: ecommerce/setup-discount-rules.md
11
- load: true
3
+ description: SEASONAL sub-flow — load [Goal: Seasonal Revenue] FIRST (it owns classification and routing); this is a sub-step, NOT a direct entry from README.
12
4
  ---
13
5
  # Flow: Seasonal Promotion
14
6
 
15
- > **Before executing this skill**, read these referenced skills with `ReadFullDocsArticle`:
16
- > - [Guardrail: Discount Conflicts](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/guardrail-discount-conflicts)
17
- > - [Setup: Discount Rules](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/setup-discount-rules)
7
+ > ⛔ **Routing gate — [Goal: Seasonal Revenue](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/goal-seasonal-revenue) must be loaded before this flow.**
8
+ >
9
+ > This flow is a sub-step, not a direct entry point. If you have not yet called `ReadFullDocsArticle` on [Goal: Seasonal Revenue](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/goal-seasonal-revenue) in this conversation, **stop and load it now**. The goal skill owns the SEASONAL classification rule, the time-window presentation requirement, and the priority rule that gates access to this flow.
10
+ >
11
+ > **Before executing this flow**, also read [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) with `ReadFullDocsArticle` — it contains the discount-rule mechanics **and** the pre-create guardrails (conflict/stacking, margin floor, %-sanity).
18
12
 
19
13
  Creates event-driven promotional discounts tied to holidays, shopping events, or seasonal milestones. The flow identifies upcoming events based on the site's country and current date, calculates optimal campaign start/end windows, and targets event-relevant product categories with appropriately sized discounts.
20
14
 
21
15
  ## Prerequisites
22
16
 
23
- - Wix Stores installed on the site
24
- - Products exist in the catalog
25
- - Access to `getCatalogAnalytics`, `getProductCatalogData`, and `getSiteData` tools
17
+ - Products exist in the catalog (`siteData.hasCatalog === true`, checked at context load)
26
18
  - `current_date` available for event scheduling
27
- - Site `country` known for region-specific event mapping
19
+ - Site `country` known for region-specific event mapping (`siteData.country`, loaded by eCommerce Load Context)
28
20
 
29
21
  ## Required APIs
30
22
 
@@ -82,27 +74,18 @@ For Black Friday + Cyber Monday, use a single extended window: start the precedi
82
74
 
83
75
  ---
84
76
 
85
- ## Step 3: Gather catalog data
77
+ ## Step 3: Use pre-loaded catalog data
86
78
 
87
- Call `getCatalogAnalytics` and `getProductCatalogData` concurrently.
79
+ Catalog analytics and product data are already in conversation context — do NOT re-fetch:
88
80
 
89
- **getCatalogAnalytics** call:
90
- ```
91
- aggregates: sum(ordersCount), quantiles([0.5, 0.9], price), avg(profitMargin)
92
- ```
93
-
94
- **getProductCatalogData** call:
95
- ```
96
- ordered: ordersCount DESC
97
- ```
98
-
99
- This sort order surfaces the best-selling products first — seasonal campaigns should lead with proven sellers to maximize revenue.
81
+ - `siteData.catalogAnalytics` — category groups with `sum(ordersCount)`, `quantiles([0.5,0.9], price)`, `avg(profitMargin)`. Loaded by the eCommerce Load Context.
82
+ - `siteData.productCatalogData` — per-product list sorted `ordersCount DESC` for SEASONAL goal. Loaded by the run-a-sale orchestrator Step 5.
100
83
 
101
- Save the following values:
102
- - `total_orders` — overall sales volume
103
- - `price_p50`, `price_p90` — price distribution for discount sizing
84
+ Extract from context:
85
+ - `total_orders` — `sum(ordersCount)` from the "All Products" group in `siteData.catalogAnalytics`
86
+ - `price_p50`, `price_p90` — from quantiles in `siteData.catalogAnalytics`
104
87
  - `avg_profit_margin` — sets discount ceiling
105
- - Top products by sales volume
88
+ - Top products by sales volume — from `siteData.productCatalogData`
106
89
 
107
90
  ---
108
91
 
@@ -160,30 +143,7 @@ If scope is CATEGORY, call `getCategoryIds` to convert category names to GUIDs.
160
143
 
161
144
  ## Step 8: Run guardrail checks
162
145
 
163
- **Run the Guardrail: Discount Conflicts checks before creating the rule.**
164
-
165
- 1. Query existing active discount rules:
166
-
167
- **Endpoint**: `POST https://www.wixapis.com/ecom/v1/discount-rules/query`
168
-
169
- **Request**:
170
- ```json
171
- {
172
- "query": {
173
- "filter": {
174
- "active": true
175
- },
176
- "paging": {
177
- "limit": 100
178
- }
179
- }
180
- }
181
- ```
182
-
183
- 2. Check for time overlap — seasonal promotions have defined windows, so check that no existing rule covers the same period on the same scope.
184
- 3. Check for scope overlap — a seasonal category discount stacking with an existing catalog-wide discount could create unexpectedly deep combined discounts.
185
- 4. Check for coupon stacking — seasonal events often have high coupon usage.
186
- 5. If conflicts found, present to merchant and get confirmation.
146
+ **Run the pre-create guardrails in [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) → "Guardrails" before creating the rule.** For seasonal campaigns the most relevant are **time overlap** (defined windows — ensure no existing rule covers the same period/scope), **scope overlap** (a category discount stacking with a catalog-wide one), and **coupon stacking** (seasonal events drive high coupon usage). Present any conflicts to the merchant and get confirmation.
187
147
 
188
148
  ---
189
149
 
@@ -1,32 +1,18 @@
1
1
  ---
2
2
  name: "Flow: Stock Mover"
3
- description: Creates discount campaigns to clear slow-moving inventory by targeting products with high stock levels and low sales velocity. Uses deeper discounts proportional to inventory urgency.
4
- layer: flow
5
- references:
6
- - name: "Guardrail: Discount Conflicts"
7
- path: ecommerce/guardrail-discount-conflicts.md
8
- load: true
9
- - name: "Guardrail: Margin Protection"
10
- path: ecommerce/guardrail-margin-protection.md
11
- load: true
12
- - name: "Setup: Discount Rules"
13
- path: ecommerce/setup-discount-rules.md
14
- load: true
3
+ description: Stock-mover clearance sub-flow — load [Goal: Clear Inventory] FIRST (it owns the routing); this is a sub-step.
15
4
  ---
16
5
  # Flow: Stock Mover Clearance
17
6
 
18
- > **Before executing this skill**, read these referenced skills with `ReadFullDocsArticle`:
19
- > - [Guardrail: Discount Conflicts](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/guardrail-discount-conflicts)
20
- > - [Guardrail: Margin Protection](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/guardrail-margin-protection)
21
- > - [Setup: Discount Rules](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/setup-discount-rules)
7
+ > **Routing rule (READ FIRST).** This recipe is a sub-step of [Goal: Clear Inventory](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/goal-clear-inventory). If you arrived here directly from the WixREADME index, load the goal recipe NOW before executing — it owns the velocity scoring, classification cues, and the per-recommendation presentation rules (including the **margin-floor guardrail** surfacing requirement).
8
+ >
9
+ > **Then** read [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) with `ReadFullDocsArticle` — it contains the discount-rule mechanics **and** the pre-create guardrails (conflict/stacking, margin floor, %-sanity).
22
10
 
23
11
  Creates a discount targeting slow-moving inventory — products with high stock levels and low sales velocity. The discount depth is proportional to how overstocked the product is, with deeper discounts for the most stagnant items. Margin protection guardrails are especially important here since clearance discounts tend to push closer to cost.
24
12
 
25
13
  ## Prerequisites
26
14
 
27
- - Wix Stores installed on the site
28
- - Products exist in the catalog with inventory (quantity) data
29
- - Access to `getCatalogAnalytics` and `getProductCatalogData` tools
15
+ - Products exist in the catalog with inventory (quantity) data (`siteData.hasCatalog === true`, checked at context load)
30
16
  - Inventory tracking enabled for target products
31
17
 
32
18
  ## Required APIs
@@ -36,27 +22,18 @@ Creates a discount targeting slow-moving inventory — products with high stock
36
22
 
37
23
  ---
38
24
 
39
- ## Step 1: Gather inventory and sales data
25
+ ## Step 1: Use pre-loaded catalog data
40
26
 
41
- Call `getCatalogAnalytics` and `getProductCatalogData` concurrently to assess stock levels and sales velocity.
27
+ Catalog analytics and product data are already in conversation context — do NOT re-fetch:
42
28
 
43
- **getCatalogAnalytics** call:
44
- ```
45
- aggregates: sum(quantity), sum(ordersCount), avg(profitMargin)
46
- ```
29
+ - `siteData.catalogAnalytics` — category groups with `sum(quantity)`, `sum(ordersCount)`, `avg(profitMargin)`. Loaded by the eCommerce Load Context.
30
+ - `siteData.productCatalogData` — per-product list sorted `quantity DESC, ordersCount ASC` for STOCK_MOVER goal. Loaded by the run-a-sale orchestrator Step 5.
47
31
 
48
- **getProductCatalogData** call:
49
- ```
50
- ordered: quantity DESC, ordersCount ASC
51
- ```
52
-
53
- This sort order surfaces products with the most stock and the fewest sales first — the primary candidates for clearance.
54
-
55
- Save the following values:
56
- - `total_quantity` — total stock across catalog
57
- - `total_orders` — total sales across catalog
58
- - `avg_profit_margin` — average profit margin (sets discount ceiling)
59
- - Per-product: `quantity`, `ordersCount`, `price`, `name`, `id`, `categoryId`
32
+ Extract from context:
33
+ - `total_quantity` — `sum(quantity)` from the "All Products" group in `siteData.catalogAnalytics`
34
+ - `total_orders` — `sum(ordersCount)` from the "All Products" group
35
+ - `avg_profit_margin` — sets the discount ceiling
36
+ - Per-product: `quantity`, `ordersCount`, `price`, `name`, `id`, `categoryId` — from `siteData.productCatalogData`
60
37
 
61
38
  ---
62
39
 
@@ -122,38 +99,7 @@ If scope is CATEGORY, call `getCategoryIds` to convert category names to GUIDs.
122
99
 
123
100
  ## Step 6: Run guardrail checks
124
101
 
125
- **IMPORTANT: Run both guardrail checks before creating the discount rule. Clearance discounts are the most likely to trigger margin warnings.**
126
-
127
- ### 6a: Discount Conflicts
128
-
129
- 1. Query existing active discount rules:
130
-
131
- **Endpoint**: `POST https://www.wixapis.com/ecom/v1/discount-rules/query`
132
-
133
- **Request**:
134
- ```json
135
- {
136
- "query": {
137
- "filter": {
138
- "active": true
139
- },
140
- "paging": {
141
- "limit": 100
142
- }
143
- }
144
- }
145
- ```
146
-
147
- 2. Check for scope overlap. Clearance items that already have an active discount would stack — warn the merchant about combined discount depth.
148
- 3. Check for coupon stacking risks. A customer combining a clearance discount with a coupon code could get an unexpectedly deep total discount.
149
-
150
- ### 6b: Margin Protection
151
-
152
- This check is especially critical for clearance:
153
-
154
- - Verify `discount_percentage <= avg_profit_margin - 15%` for each candidate product.
155
- - If the discount would push effective margin below 15%, warn the merchant: "This clearance discount of {discount}% on {product_name} would reduce the effective margin to {remaining_margin}%. The minimum margin threshold is 15%. Proceed?"
156
- - If margin data is unavailable, apply extra caution — cap at 15% unless the merchant explicitly overrides.
102
+ **Run the pre-create guardrails in [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) → "Guardrails" before creating the rule** (conflict/stacking, %-sanity, margin floor). Clearance is the **most margin-sensitive** case: discounts push closest to cost, so the margin-floor check (effective margin ≥ 15% unless the merchant overrides) is the one most likely to fire here — verify it per candidate product.
157
103
 
158
104
  ---
159
105
 
@@ -278,7 +224,19 @@ Save the returned `id` and `revision` for later management.
278
224
  1. Query discount rules to confirm the new rule exists and is `active: true`
279
225
  2. Verify the correct products or category are targeted
280
226
  3. Report to the merchant:
281
- > "Clearance discount is live: {discount}% off {number_of_products} slow-moving items. These products had a velocity ratio of {avg_velocity}, indicating high stock relative to sales. Monitor inventory levels — once stock clears, consider deactivating the rule."
227
+ > "Clearance discount is live: {discount}% off {number_of_products} slow-moving items. These products had a velocity ratio of {avg_velocity}, indicating high stock relative to sales. **Margin floor enforced — effective margin stays ≥ 15% on every targeted SKU.** Monitor inventory levels — once stock clears, consider deactivating the rule."
228
+
229
+ ---
230
+
231
+ ## Presentation requirement — margin guardrail line is mandatory
232
+
233
+ When generating recommendations for the merchant (whether persisted as PROPOSED via the tracking API or returned inline), **every clearance recommendation MUST include explicit margin-floor language in its `reasoning` / `why` field.** Examples:
234
+
235
+ - "Discount keeps effective margin ≥ 15% (minMarginPct floor)."
236
+ - "Pre-discount margin {X}%, post-discount {Y}% — above 15% breakeven floor."
237
+ - "Margin protected: 20% off does NOT push `{product}` below the 15% floor."
238
+
239
+ Urgency labels, stock level, capital tied up, and the "Why {N}%" velocity rationale are NOT substitutes — the merchant must see a per-item margin protection statement on every clearance line. If you cannot meet the floor at the velocity-tier discount, either reduce the discount or drop the item; never silently breach the floor.
282
240
 
283
241
  ---
284
242
 
@@ -1,33 +1,17 @@
1
1
  ---
2
2
  name: "Flow: Upsell Boost"
3
- description: Creates a discount campaign to increase average order value by setting minimum subtotal conditions above current AOV. Uses margin-based discount tiers and targets high-margin categories.
4
- layer: flow
5
- references:
6
- - name: "Guardrail: Discount Conflicts"
7
- path: ecommerce/guardrail-discount-conflicts.md
8
- load: true
9
- - name: "Guardrail: Margin Protection"
10
- path: ecommerce/guardrail-margin-protection.md
11
- load: true
12
- - name: "Setup: Discount Rules"
13
- path: ecommerce/setup-discount-rules.md
14
- load: true
3
+ description: UPSELL_BOOST sub-flow — load [Goal: Increase AOV] FIRST (it owns classification and routing); this is a sub-step, NOT a direct entry from README.
15
4
  ---
16
5
  # Flow: Upsell Boost Campaign
17
6
 
18
- > **Before executing this skill**, read these referenced skills with `ReadFullDocsArticle`:
19
- > - [Guardrail: Discount Conflicts](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/guardrail-discount-conflicts)
20
- > - [Guardrail: Margin Protection](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/guardrail-margin-protection)
21
- > - [Setup: Discount Rules](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/setup-discount-rules)
7
+ > **Before executing this skill**, read [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) with `ReadFullDocsArticle` — it contains the discount-rule mechanics **and** the pre-create guardrails (conflict/stacking, margin floor, %-sanity).
22
8
 
23
9
  Creates a discount that incentivizes customers to spend more per order by setting a minimum subtotal threshold above the store's current AOV. The discount percentage is scaled to the store's average profit margin, and the scope targets high-margin categories or products.
24
10
 
25
11
  ## Prerequisites
26
12
 
27
- - Wix Stores installed on the site
28
- - Products exist in the catalog with price data
29
- - Access to `getCatalogAnalytics` and `getProductCatalogData` tools
30
- - AOV data available from site metrics (revenue / ordersCount)
13
+ - Products exist in the catalog with price data (`siteData.hasCatalog === true`, checked at context load)
14
+ - AOV data available from site metrics (`siteData.aov`, loaded by eCommerce Load Context)
31
15
 
32
16
  ## Required APIs
33
17
 
@@ -36,27 +20,19 @@ Creates a discount that incentivizes customers to spend more per order by settin
36
20
 
37
21
  ---
38
22
 
39
- ## Step 1: Gather catalog data and site metrics
23
+ ## Step 1: Use pre-loaded catalog data
40
24
 
41
- Call `getCatalogAnalytics` and `getProductCatalogData` concurrently to collect pricing, margin, and product data.
25
+ Catalog analytics and product data are already in conversation context — do NOT re-fetch:
42
26
 
43
- **getCatalogAnalytics** call:
44
- ```
45
- aggregates: count, quantiles([0.5, 0.75, 0.9], price), avg(profitMargin)
46
- ```
47
-
48
- **getProductCatalogData** call:
49
- ```
50
- ordered: price DESC, ordersCount DESC
51
- ```
27
+ - `siteData.catalogAnalytics` — category groups with `count()`, `quantiles([0.5,0.75,0.9], price)`, `avg(profitMargin)`. Loaded by the eCommerce Load Context.
28
+ - `siteData.productCatalogData` — per-product list sorted `price DESC, ordersCount DESC` for UPSELL_BOOST goal. Loaded by the run-a-sale orchestrator Step 5.
29
+ - `siteData.aov` — site-level AOV (revenue / ordersCount). Loaded by eCommerce Load Context.
52
30
 
53
- Also retrieve site-level AOV from `getSiteData` (AOV = revenue / ordersCount). Run the AOV sanity check: if AOV < price_p25, override with price_p50 as the effective AOV.
54
-
55
- Save the following values:
56
- - `effective_aov` — the validated average order value
57
- - `avg_profit_margin` — average profit margin across the catalog
58
- - `price_p50`, `price_p75`, `price_p90` — pricing quantiles
59
- - Top products by price and order volume
31
+ Extract from context:
32
+ - `effective_aov` — use `siteData.aov`; run AOV sanity check: if AOV < price_p25, override with price_p50 as effective AOV
33
+ - `avg_profit_margin` — from the "All Products" group in `siteData.catalogAnalytics`
34
+ - `price_p50`, `price_p75`, `price_p90` — from quantiles in `siteData.catalogAnalytics`
35
+ - Top products by price and order volume — from `siteData.productCatalogData`
60
36
 
61
37
  ---
62
38
 
@@ -114,36 +90,7 @@ Max 3 categoryIds per discount rule.
114
90
 
115
91
  ## Step 6: Run guardrail checks
116
92
 
117
- **IMPORTANT: Run both guardrail checks before creating the discount rule.**
118
-
119
- ### 6a: Discount Conflicts
120
-
121
- 1. Query existing active discount rules:
122
-
123
- **Endpoint**: `POST https://www.wixapis.com/ecom/v1/discount-rules/query`
124
-
125
- **Request**:
126
- ```json
127
- {
128
- "query": {
129
- "filter": {
130
- "active": true
131
- },
132
- "paging": {
133
- "limit": 100
134
- }
135
- }
136
- }
137
- ```
138
-
139
- 2. Check for scope overlap, time overlap, and coupon stacking risks with the planned upsell discount.
140
- 3. If conflicts found, present to merchant and get confirmation before proceeding.
141
-
142
- ### 6b: Margin Protection
143
-
144
- Verify that `discount_percentage <= avg_profit_margin - 15%` (minMarginPct). If the discount would push effective margin below 15%, warn the merchant.
145
-
146
- The global discount cap is 25%. Do not exceed this unless the merchant explicitly overrides it.
93
+ **Run the pre-create guardrails in [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) → "Guardrails" before creating the rule** — conflict/stacking (scope, time, coupon cross-stacking), the 25% cap, the 15% margin floor, and %-sanity. Present any warnings to the merchant and get confirmation before proceeding.
147
94
 
148
95
  ---
149
96