@wix/agent-skills 1.11.0 → 1.13.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.
- package/README.md +4 -0
- package/package.json +1 -1
- package/skills/wix-app/references/data-collection/WIX_DATA.md +10 -0
- package/skills/wix-design-system/SKILL.md +3 -1
- package/skills/wix-manage/SKILL.md +32 -54
- package/skills/wix-manage/references/ecommerce/api-recommendation-tracking.md +3 -2
- package/skills/wix-manage/references/ecommerce/ecom-load-context.md +144 -0
- package/skills/wix-manage/references/ecommerce/ecom-pricing.md +84 -0
- package/skills/wix-manage/references/ecommerce/ecom-shipping.md +64 -0
- package/skills/wix-manage/references/ecommerce/{setup-coupons.md → pricing-promotions/ecom-pricing-create-coupon.md} +20 -6
- package/skills/wix-manage/references/ecommerce/{setup-discount-rules.md → pricing-promotions/ecom-pricing-create-discount-rule.md} +31 -1
- package/skills/wix-manage/references/ecommerce/{flow-bundle-and-save.md → pricing-promotions/ecom-pricing-flow-bundle-and-save.md} +11 -52
- package/skills/wix-manage/references/ecommerce/{flow-seasonal-promotion.md → pricing-promotions/ecom-pricing-flow-seasonal-promotion.md} +17 -57
- package/skills/wix-manage/references/ecommerce/{flow-stock-mover.md → pricing-promotions/ecom-pricing-flow-stock-mover.md} +28 -70
- package/skills/wix-manage/references/ecommerce/{flow-upsell-boost.md → pricing-promotions/ecom-pricing-flow-upsell-boost.md} +15 -68
- package/skills/wix-manage/references/ecommerce/{goal-clear-inventory.md → pricing-promotions/ecom-pricing-goal-clear-inventory.md} +22 -13
- package/skills/wix-manage/references/ecommerce/{goal-drive-cross-sells.md → pricing-promotions/ecom-pricing-goal-drive-cross-sells.md} +26 -8
- package/skills/wix-manage/references/ecommerce/{goal-increase-aov.md → pricing-promotions/ecom-pricing-goal-increase-aov.md} +32 -25
- package/skills/wix-manage/references/ecommerce/{goal-seasonal-revenue.md → pricing-promotions/ecom-pricing-goal-seasonal-revenue.md} +21 -8
- package/skills/wix-manage/references/ecommerce/{troubleshoot-discount-not-applying.md → pricing-promotions/ecom-pricing-troubleshoot-not-applying.md} +1 -1
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +23 -47
- package/skills/wix-manage/references/ecommerce/{api-shipping.md → shipping/ecom-shipping-api.md} +4 -3
- package/skills/wix-manage/references/ecommerce/{flow-fix-coverage-gaps.md → shipping/ecom-shipping-fix-coverage.md} +23 -17
- package/skills/wix-manage/references/ecommerce/{flow-add-free-shipping.md → shipping/ecom-shipping-free-shipping.md} +23 -18
- package/skills/wix-manage/references/ecommerce/{flow-optimize-shipping-rates.md → shipping/ecom-shipping-optimize-rates.md} +19 -16
- package/skills/wix-manage/references/ecommerce/{setup-store-pickup-location.md → shipping/ecom-shipping-setup-pickup.md} +12 -10
- package/skills/wix-manage/references/ecommerce/{setup-shipping-rates.md → shipping/ecom-shipping-setup-rates.md} +1 -2
- package/skills/wix-manage/references/ecommerce/{setup-shipping-regions.md → shipping/ecom-shipping-setup-regions.md} +1 -2
- package/skills/wix-manage/references/sites/query-sites.md +104 -32
- package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +0 -147
- package/skills/wix-manage/references/ecommerce/guardrail-discount-conflicts.md +0 -118
- package/skills/wix-manage/references/ecommerce/guardrail-margin-protection.md +0 -88
- package/skills/wix-manage/references/ecommerce/guardrail-rate-pricing-sanity.md +0 -108
- package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +0 -124
- package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +0 -298
- package/skills/wix-manage/references/ecommerce/skill-graph.md +0 -139
- package/skills/wix-manage/references/ecommerce/troubleshoot-checkout-delivery-dropoff.md +0 -124
package/README.md
CHANGED
|
@@ -92,6 +92,10 @@ Run the [`release-bump`](.github/workflows/release-bump.yml) workflow from the *
|
|
|
92
92
|
|
|
93
93
|
See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on adding new skills.
|
|
94
94
|
|
|
95
|
+
### Eval Token Budgets
|
|
96
|
+
|
|
97
|
+
Eval scenarios under `yaml/wix-manage-evals/` may define a top-level `maxTokens` value. The GitHub Actions eval gate compares that budget against the PR run's total tokens for the scenario and fails the PR check when the budget is exceeded. This gate-owned field is separate from `llm_judge.maxTokens`, which only configures the judge assertion.
|
|
98
|
+
|
|
95
99
|
## License
|
|
96
100
|
|
|
97
101
|
MIT
|
package/package.json
CHANGED
|
@@ -261,6 +261,16 @@ const bulkResult = await items.bulkInsert("MyCollection", [
|
|
|
261
261
|
| `get`, `query`, `count`, `distinct` | `SCOPE.DC-DATA.READ` |
|
|
262
262
|
| `insert`, `update`, `save`, `remove`, `bulkInsert`, `bulkUpdate`, `bulkRemove` | `SCOPE.DC-DATA.WRITE` |
|
|
263
263
|
|
|
264
|
+
### Elevating permissions (backend only)
|
|
265
|
+
|
|
266
|
+
In backend code (service plugins, events, backend APIs), wrap the `items` method with `auth.elevate` from `@wix/essentials` to run with elevated permissions:
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
import { auth } from '@wix/essentials';
|
|
270
|
+
const elevatedQuery = auth.elevate(items.query);
|
|
271
|
+
const configResult = await elevatedQuery('MyCollection').find();
|
|
272
|
+
```
|
|
273
|
+
|
|
264
274
|
## Date/Time Handling
|
|
265
275
|
|
|
266
276
|
- **Date (date-only)**: Store as a string in "YYYY-MM-DD" format (as returned by `<input type="date" />`).
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: wix-design-system
|
|
3
|
-
description: Wix Design System component reference. Use when building UI with @wix/design-system, choosing components, checking props and examples, or writing tests with component testkits. Triggers on "what component", "how do I make", "WDS", "show me props", "testkit", "driver", or component names like Button, Card, Box, Text.
|
|
3
|
+
description: Wix Design System component reference. Use when building UI with @wix/design-system, choosing components, checking props and examples, or writing tests with component testkits. Triggers on "what component", "how do I make", "WDS", "show me props", "testkit", "driver", or component names like Button, Card, Modal, Box, Text.
|
|
4
|
+
metadata:
|
|
5
|
+
verified: true
|
|
4
6
|
---
|
|
5
7
|
|
|
6
8
|
# WDS Documentation Navigator
|
|
@@ -121,66 +121,44 @@ These recipes do NOT cover frontend development or SDK usage for displaying data
|
|
|
121
121
|
## eCommerce
|
|
122
122
|
|
|
123
123
|
**Routing — pick the right entry point:**
|
|
124
|
-
- **Any sales/business improvement request** (boost sales, promotions, help my business, holiday deals, improve revenue, discounts, shipping, coupons, clearance) → use [Recommend: eCommerce Strategy](references/ecommerce/recommend-ecommerce-strategy.md). This is the **default entry point** — it analyzes ALL domains (discounts, shipping
|
|
125
|
-
- **
|
|
126
|
-
- **
|
|
127
|
-
- **Discount not working at checkout** → use [Troubleshoot: Discount Not Applying](references/ecommerce/troubleshoot-discount-not-applying.md)
|
|
128
|
-
- **Checkout delivery step drop-off** → use [Troubleshoot: Checkout Delivery Drop-off](references/ecommerce/troubleshoot-checkout-delivery-dropoff.md)
|
|
124
|
+
- **Any sales/business improvement request** (boost sales, promotions, help my business, holiday deals, improve revenue, discounts, shipping, coupons, clearance) → use [Recommend: eCommerce Strategy](references/ecommerce/recommend-ecommerce-strategy.md). This is the **default entry point** — it analyzes ALL domains (discounts, shipping) and generates cross-domain recommendations. Do NOT ask clarifying questions.
|
|
125
|
+
- **Pricing & promotions** (coupons, discount rules, ribbons, sales) → use the [Pricing & Promotions](references/ecommerce/ecom-pricing.md) dispatcher.
|
|
126
|
+
- **Shipping setup** (rates, regions, pickup, free shipping, fix coverage) → use the [Shipping](references/ecommerce/ecom-shipping.md) dispatcher.
|
|
129
127
|
|
|
130
|
-
### [
|
|
131
|
-
**
|
|
132
|
-
|
|
133
|
-
### [Recipe: Apply Shipping Recommendations](references/ecommerce/recipe-apply-shipping-recommendations.md)
|
|
134
|
-
**Technical:** Applies AI-generated shipping recommendations. Creates or updates shipping options based on recommendation data.
|
|
128
|
+
### [eCommerce: Load Context](references/ecommerce/ecom-load-context.md)
|
|
129
|
+
**L1 loader** — loads general site data (siteId, country, currency, industry, catalog analytics) needed by every eCommerce category. Each category dispatcher loads this before tag-matching; runs once per session.
|
|
135
130
|
|
|
136
|
-
### [
|
|
137
|
-
**
|
|
131
|
+
### [Recommend: eCommerce Strategy](references/ecommerce/recommend-ecommerce-strategy.md)
|
|
132
|
+
**Entry point for all eCommerce recommendation requests.** Unified skill that analyzes site data across ALL domains (discounts + shipping), generates up to 5 cross-domain recommendations, and persists them to the tracking database. Covers discount strategies (seasonal, upsell, stock mover, bundling) AND shipping optimization (coverage gaps, free shipping, rate strategy, carrier backup). Use this for ANY business improvement request.
|
|
138
133
|
|
|
139
|
-
### [
|
|
140
|
-
**
|
|
134
|
+
### [Pricing & Promotions](references/ecommerce/ecom-pricing.md)
|
|
135
|
+
**Dispatcher** — routes coupon/discount/sale/ribbon/bundle requests to the right leaf recipe (create coupon, create discount rule, troubleshoot discount-not-applying), and routes strategic "run a sale / boost sales" requests to `recommend-ecommerce-strategy`.
|
|
141
136
|
|
|
142
|
-
### [
|
|
143
|
-
**
|
|
137
|
+
### [Shipping](references/ecommerce/ecom-shipping.md)
|
|
138
|
+
**Dispatcher** — routes shipping-setup requests (rates, regions, pickup, free shipping, fix coverage, optimize rates) to the right leaf recipe. The Shipping Options + Delivery Profiles APIs have no public docs page; `ecom-shipping-api.md` is the authoritative inline reference.
|
|
144
139
|
|
|
145
140
|
<details>
|
|
146
|
-
<summary>Internal skills (loaded automatically by the
|
|
147
|
-
|
|
148
|
-
####
|
|
149
|
-
- [
|
|
150
|
-
- [
|
|
151
|
-
- [
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
|
|
155
|
-
####
|
|
156
|
-
- [
|
|
157
|
-
- [
|
|
158
|
-
- [
|
|
159
|
-
- [
|
|
160
|
-
- [
|
|
161
|
-
- [
|
|
162
|
-
- [
|
|
163
|
-
|
|
164
|
-
####
|
|
165
|
-
- [
|
|
166
|
-
|
|
167
|
-
- [Guardrail: Shipping Health](references/ecommerce/guardrail-shipping-health.md)
|
|
168
|
-
- [Guardrail: Rate Pricing Sanity](references/ecommerce/guardrail-rate-pricing-sanity.md)
|
|
169
|
-
|
|
170
|
-
#### Config & API References
|
|
171
|
-
- [API: Recommendation Tracking](references/ecommerce/api-recommendation-tracking.md)
|
|
172
|
-
- [API: Shipping Delivery](references/ecommerce/api-shipping.md)
|
|
173
|
-
- [Setup: Discount Rules](references/ecommerce/setup-discount-rules.md)
|
|
174
|
-
- [Setup: Coupons](references/ecommerce/setup-coupons.md)
|
|
175
|
-
- [Setup: Shipping Regions](references/ecommerce/setup-shipping-regions.md)
|
|
176
|
-
- [Setup: Shipping Rates](references/ecommerce/setup-shipping-rates.md)
|
|
177
|
-
|
|
178
|
-
#### Tracking
|
|
179
|
-
- Tracking is built into [Recommend: eCommerce Strategy](references/ecommerce/recommend-ecommerce-strategy.md) (Steps 2 + 8) — no separate skill needed
|
|
180
|
-
- [API: Recommendation Tracking](references/ecommerce/api-recommendation-tracking.md) — CRUD API reference for the tracking service
|
|
181
|
-
|
|
182
|
-
#### Reference
|
|
183
|
-
- [Skill Graph](references/ecommerce/skill-graph.md)
|
|
141
|
+
<summary>Internal skills (loaded automatically by the dispatchers / orchestrator above — do NOT use directly)</summary>
|
|
142
|
+
|
|
143
|
+
#### Pricing & promotions leaves (loaded by the Pricing dispatcher or by the strategy orchestrator)
|
|
144
|
+
- [Pricing: Create Coupon](references/ecommerce/pricing-promotions/ecom-pricing-create-coupon.md)
|
|
145
|
+
- [Pricing: Create Discount Rule](references/ecommerce/pricing-promotions/ecom-pricing-create-discount-rule.md)
|
|
146
|
+
- [Pricing: Discount Not Applying](references/ecommerce/pricing-promotions/ecom-pricing-troubleshoot-not-applying.md)
|
|
147
|
+
- Goals: [Increase AOV](references/ecommerce/pricing-promotions/ecom-pricing-goal-increase-aov.md), [Clear Inventory](references/ecommerce/pricing-promotions/ecom-pricing-goal-clear-inventory.md), [Seasonal Revenue](references/ecommerce/pricing-promotions/ecom-pricing-goal-seasonal-revenue.md), [Drive Cross-Sells](references/ecommerce/pricing-promotions/ecom-pricing-goal-drive-cross-sells.md)
|
|
148
|
+
- Flows: [Upsell Boost](references/ecommerce/pricing-promotions/ecom-pricing-flow-upsell-boost.md), [Bundle and Save](references/ecommerce/pricing-promotions/ecom-pricing-flow-bundle-and-save.md), [Stock Mover](references/ecommerce/pricing-promotions/ecom-pricing-flow-stock-mover.md), [Seasonal Promotion](references/ecommerce/pricing-promotions/ecom-pricing-flow-seasonal-promotion.md)
|
|
149
|
+
|
|
150
|
+
#### Shipping leaves (loaded by the Shipping dispatcher)
|
|
151
|
+
- [Set Up Rates](references/ecommerce/shipping/ecom-shipping-setup-rates.md)
|
|
152
|
+
- [Set Up Regions](references/ecommerce/shipping/ecom-shipping-setup-regions.md)
|
|
153
|
+
- [Set Up Pickup / Local Delivery](references/ecommerce/shipping/ecom-shipping-setup-pickup.md)
|
|
154
|
+
- [Add Free Shipping](references/ecommerce/shipping/ecom-shipping-free-shipping.md)
|
|
155
|
+
- [Optimize Rates](references/ecommerce/shipping/ecom-shipping-optimize-rates.md)
|
|
156
|
+
- [Fix Coverage Gaps](references/ecommerce/shipping/ecom-shipping-fix-coverage.md)
|
|
157
|
+
- [API Reference](references/ecommerce/shipping/ecom-shipping-api.md) — inline spec for Shipping Options + Delivery Profiles
|
|
158
|
+
|
|
159
|
+
#### Cross-cutting tracking
|
|
160
|
+
- [API: Recommendation Tracking](references/ecommerce/api-recommendation-tracking.md) — load BEFORE generating any recommendation; persists PROPOSED state and tracks MarkExecuting → MarkDone/MarkFailed.
|
|
161
|
+
|
|
184
162
|
|
|
185
163
|
</details>
|
|
186
164
|
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "API: Recommendation Tracking"
|
|
3
|
-
description:
|
|
4
|
-
layer: config
|
|
3
|
+
description: Cross-cutting tracking API for AI-generated recommendations across eCommerce categories (checkout, shipping, pricing). ALWAYS LOAD BEFORE generating a "give me N recommendations / concrete actions" response, in addition to the category recipe.
|
|
5
4
|
---
|
|
6
5
|
# API: Recommendation Tracking Service
|
|
7
6
|
|
|
@@ -11,6 +10,8 @@ This service persists recommendations in a database and tracks their lifecycle s
|
|
|
11
10
|
|
|
12
11
|
**Base URL**: `https://manage.wix.com/_api/agentic-recommendations/v1/agentic-recommendations`
|
|
13
12
|
|
|
13
|
+
> **Internal-but-callable API.** This is a Wix-internal service with NO public `dev.wix.com` docs page. It **IS callable via `CallWixSiteAPI`** in the authenticated editor/dashboard context the MCP runs in (verified: the endpoints return auth/validation errors, not 404). This file is the authoritative spec — do not try to `ReadFullDocsArticle` an external doc for it.
|
|
14
|
+
|
|
14
15
|
## How to call these APIs
|
|
15
16
|
|
|
16
17
|
Use `CallWixSiteAPI` to invoke each endpoint:
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "eCommerce: Load Context"
|
|
3
|
+
description: "eCommerce L1 context loader — calls wix-profile-client/v4/profile/metasite (NOT site-properties) to load siteId, country, currency, industry, last-30-day visitors/orders/GPV. Skip if already loaded."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# eCommerce: Load Context
|
|
7
|
+
|
|
8
|
+
> **L1 loader pattern.** Each L1 domain (eCommerce, Stores, Get-paid, Contacts, …) owns its own context loader. This file is the **eCommerce** L1 loader. Other L1s have their own (e.g. `stores-load-context.md` will detect Catalog V1/V3 for Stores categories). The boilerplate (Step 1 + 2) is small; the **field list and runtime detections differ by L1**.
|
|
9
|
+
|
|
10
|
+
> **When to run.** Called from the dispatch block of any eCommerce category's `default.md` (Tax, Pricing & promotions, …) before tag-matching. Run **once per session**. If `siteData.country` is already in your conversation context, skip the API calls below and return immediately — every subsequent eCommerce category entry reuses the loaded data.
|
|
11
|
+
|
|
12
|
+
This is the canonical extract of Steps 1 + 3 from today's `recommend-ecommerce-strategy.md`, scoped to the fields eCommerce categories actually need.
|
|
13
|
+
|
|
14
|
+
## Step 1 — Resolve siteId
|
|
15
|
+
|
|
16
|
+
If a `siteId` is not already known, call `ListWixSites`:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
ListWixSites()
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
- If the merchant referenced a site by name, match it.
|
|
23
|
+
- If exactly one site exists, auto-select it.
|
|
24
|
+
- Otherwise, ask the merchant which site to use.
|
|
25
|
+
|
|
26
|
+
**Do not proceed without a `siteId`.**
|
|
27
|
+
|
|
28
|
+
## Step 2 — Load business profile (the canonical endpoint)
|
|
29
|
+
|
|
30
|
+
Same call today's `recommend-ecommerce-strategy.md` Step 3 makes. The field list below is the **eCommerce** subset — orchestrator-needed metrics (visitors / orders / GPV → AOV) plus locale/currency/industry used for dispatch tags and recommendations.
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
CallWixSiteAPI(
|
|
34
|
+
url: "https://www.wix.com/wix-profile-client/v4/profile/metasite",
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: {
|
|
37
|
+
"fields": [
|
|
38
|
+
"language",
|
|
39
|
+
"merchant_business_country",
|
|
40
|
+
"suggested_main_industry",
|
|
41
|
+
"suggested_sub_industry",
|
|
42
|
+
"last_30_days_distinct_visitors",
|
|
43
|
+
"last_30_days_orders_count",
|
|
44
|
+
"online_gpv_last_30_days",
|
|
45
|
+
"payment_currency"
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Extract each field into conversation context as `siteData`:
|
|
52
|
+
|
|
53
|
+
| Field in response | Maps to | Notes |
|
|
54
|
+
|---|---|---|
|
|
55
|
+
| `fields.language.aSingleValue.aString` | `siteData.language` | Locale code (e.g. `en-US`) |
|
|
56
|
+
| `fields.merchant_business_country.aSingleValue.aString` | `siteData.country` | ISO-3166-1 alpha-2 |
|
|
57
|
+
| `fields.suggested_main_industry.aSingleValue.aString` | `siteData.industry` | Used by Pricing orchestrator's goal classification |
|
|
58
|
+
| `fields.suggested_sub_industry.aSingleValue.aString` | `siteData.subIndustry` | Optional |
|
|
59
|
+
| `fields.last_30_days_distinct_visitors.aSingleValue.aLong` | `siteData.visitors30d` | **Returned as JSON string** — `parseInt` before arithmetic |
|
|
60
|
+
| `fields.last_30_days_orders_count.aSingleValue.aLong` | `siteData.orders30d` | parseInt |
|
|
61
|
+
| `fields.online_gpv_last_30_days.aSingleValue.aLong` | `siteData.gpv30d` | parseInt |
|
|
62
|
+
| `fields.payment_currency.aSingleValue.aString` | `siteData.currency` | ISO-4217 |
|
|
63
|
+
|
|
64
|
+
Missing fields ⇒ no data for that field (don't fabricate). If `merchant_business_country`, `suggested_main_industry`, or `online_gpv_last_30_days` are missing or null, surface to the merchant: "Cannot resolve required site data: <fields>." and stop.
|
|
65
|
+
|
|
66
|
+
**Derived value:** `siteData.aov = parseInt(gpv30d) / parseInt(orders30d)` — in `siteData.currency` units.
|
|
67
|
+
|
|
68
|
+
## Step 2b — Detect catalog presence and load analytics
|
|
69
|
+
|
|
70
|
+
Call `GetCatalogAnalytics` once here so all downstream pricing/promotions flows can reference `siteData.catalogAnalytics` without re-fetching.
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
CallWixSiteAPI(
|
|
74
|
+
url: "https://manage.wix.com/recommendations/v1/recommendations/get-catalog-analytics-tool",
|
|
75
|
+
method: "POST",
|
|
76
|
+
body: {
|
|
77
|
+
"aggregates": [
|
|
78
|
+
{"op":"count","field":"price"},
|
|
79
|
+
{"op":"min","field":"price"},
|
|
80
|
+
{"op":"max","field":"price"},
|
|
81
|
+
{"op":"avg","field":"profitMargin"},
|
|
82
|
+
{"op":"quantiles","field":"price","q":[0.5,0.75,0.9]},
|
|
83
|
+
{"op":"sum","field":"quantity"},
|
|
84
|
+
{"op":"sum","field":"ordersCount"}
|
|
85
|
+
],
|
|
86
|
+
"minMarginPct": 0.15
|
|
87
|
+
}
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Save the full `categoryGroups` array as `siteData.catalogAnalytics`. From the "All Products" group extract:
|
|
92
|
+
- `siteData.catalogProductCount` = `count()` value (0 if missing or call fails)
|
|
93
|
+
- `siteData.hasCatalog` = `siteData.catalogProductCount > 0`
|
|
94
|
+
|
|
95
|
+
If the call fails, set `siteData.hasCatalog = true` (assume catalog exists; let downstream fail naturally).
|
|
96
|
+
|
|
97
|
+
**This data is used by all pricing & promotions discount flows.** Flows that require a product catalog (Bundle & Save, Upsell Boost, Stock Mover, Seasonal) MUST check `siteData.hasCatalog` before proceeding — if `false`, stop with: "This site has no products. Set up your product catalog first before running promotions."
|
|
98
|
+
|
|
99
|
+
## Step 3 — Derive region (used by dispatch context tags)
|
|
100
|
+
|
|
101
|
+
From `siteData.country`, set `siteData.region`:
|
|
102
|
+
- `BR | AR | MX | CL | CO | PE` → `LATAM`
|
|
103
|
+
- EU member states (`DE | FR | IT | ES | NL | BE | PL | SE | IE | AT | PT | FI | DK | CZ | HU | GR | RO | BG | HR | SK | SI | LT | LV | EE | CY | MT | LU`) → `EU`
|
|
104
|
+
- `JP | CN | KR | SG | AU | NZ | IN | TH | ID | MY | PH | VN | HK | TW` → `APAC`
|
|
105
|
+
- otherwise → `null`
|
|
106
|
+
|
|
107
|
+
(UK is **not** in `region:EU`. AU/NZ are in `region:APAC` but Tax inclusive-pricing rules differ — handled inside Tax promotions.)
|
|
108
|
+
|
|
109
|
+
## Step 4 — Return
|
|
110
|
+
|
|
111
|
+
Return immediately. Subsequent eCommerce category dispatches read `siteData.*` from conversation context without re-fetching. If the agent crosses into a different L1 (e.g. Stores) within the same session, that L1's loader will see `siteData.country` already loaded, skip its Steps 1-3, and only fire its own general derivations.
|
|
112
|
+
|
|
113
|
+
## Architectural rule — general site data only
|
|
114
|
+
|
|
115
|
+
**This file must contain only general / cross-cutting site data** — fields that **every** category in this L1 needs. It must **not** include L3-category-specific runtime detection (e.g. Tax calculator, Catalog V1/V3, payment-provider state, shipping-coverage state).
|
|
116
|
+
|
|
117
|
+
Reasoning:
|
|
118
|
+
- Per-category detect calls accumulate cost on every session entry, even when the agent never visits that category.
|
|
119
|
+
- L3-specific state can use APIs that aren't TPA-public (e.g. the Wix Tax FQDNs are `exposure: INTERNAL`); if the L1 loader depends on them, the entire L1 fails to load. Keeping the loader general-only contains the blast radius.
|
|
120
|
+
- Per-category state can change independently of the merchant; loading it eagerly invites stale-data bugs.
|
|
121
|
+
|
|
122
|
+
**Where category-specific runtime data is detected instead:** inside the category's `default.md` (Step before dispatch) or inside the specific promotion that needs it. The L1 loader does **not** prime per-category fields; the category does its own detection lazily, only when its own intent dispatch fires.
|
|
123
|
+
|
|
124
|
+
Concretely for the categories we know about:
|
|
125
|
+
- **Tax** — calculator detection (Manual vs Avalara) belongs in `ecom-tax.md` (the merged category-doc + dispatcher) or in each Tax promotion when it runs. Not here.
|
|
126
|
+
- **Catalog V1/V3 version detection** — belongs in the Stores category loader when Stores migrates. `getCatalogAnalytics` (product count/margin/price) is already loaded here as a cross-cutting concern; V1/V3 detection is a separate, Stores-specific signal.
|
|
127
|
+
- **Payments & finance** (when Get-paid migrates) — payment-provider state belongs in `finance-and-payments/get-paid-finance-default.md`.
|
|
128
|
+
|
|
129
|
+
## What this file does NOT do
|
|
130
|
+
|
|
131
|
+
- **Does not detect per-category runtime state** (see architectural rule above).
|
|
132
|
+
- **Does not load tracking history.** But: if any recipe in this session generates a recommendation to present to the merchant — regardless of which eCommerce category — it MUST load [API: Recommendation Tracking](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/api-recommendation-tracking) and follow the lifecycle: load history before generating (Query), persist as PROPOSED via BatchCreate before presenting, and track execution via MarkExecuting / MarkDone / MarkFailed. This obligation applies to ALL eCommerce domains.
|
|
133
|
+
- **Does not load non-eCommerce L1 fields** (catalog V1/V3 version detection, payment provider, …). Those belong inside the owning L1's category-level files (per the architectural rule). Note: `getCatalogAnalytics` (product count, margin, price distribution) IS loaded here as a cross-cutting concern; Catalog V1/V3 version detection is separate and belongs in the Stores category's own loader.
|
|
134
|
+
- **Does not enforce dispatch.** The category's `default.md` is what scores tags and picks a promotion — this file only fills general site context.
|
|
135
|
+
|
|
136
|
+
## Pattern for future L1 loaders
|
|
137
|
+
|
|
138
|
+
When a new L1 domain is migrated to the routing tree, author a `<l1>-load-context.md` at its root:
|
|
139
|
+
|
|
140
|
+
- `references/stores/stores-load-context.md` — Stores L1 loader. Steps 1-3 same boilerplate, Step 4 runtime-detects Catalog version (V1/V3) and any other Stores-specific fields.
|
|
141
|
+
- `references/get-paid/get-paid-load-context.md` — Get-paid L1 loader. Step 4 inspects payment provider state, enabled methods.
|
|
142
|
+
- `references/contacts/contacts-load-context.md` — Contacts L1 loader. Possibly minimal — most CRM ops don't need runtime detection.
|
|
143
|
+
|
|
144
|
+
Each lives sibling to its L1's category-docs. Each is referenced from every category's `default.md` within its L1. Skip-if-loaded check across L1s makes cross-L1 sessions cost-free.
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Pricing & Promotions"
|
|
3
|
+
description: Pricing & Promotions boundary owner — discounts, coupons, sales, ribbons, bundles. **Always load this dispatcher first when a question touches both discount work and refunds, payments, product-price edits, or shipping rates** — the rules for which side owns each topic live in this file, not in this README line.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pricing & Promotions
|
|
7
|
+
|
|
8
|
+
Discount rules, coupon codes, sales, ribbons, bundles, tiered pricing, and the strategic side of "run a promotion to grow revenue".
|
|
9
|
+
|
|
10
|
+
> **Routing rule (READ FIRST).** Any merchant query that mentions BOTH a Pricing-side topic (discount, coupon, sale, ribbon, bundle, promotion strategy) AND a NON-pricing-side topic (refunding a past order, processing a payment, editing the product's base price, shipping rates) MUST be answered by loading this dispatcher first AND the relevant other category (refunds → Get Paid / Dashboard; price → Catalog; shipping rates → Shipping). Do NOT route mixed queries from the WixREADME index alone; the binding decision lives here.
|
|
11
|
+
|
|
12
|
+
**Pricing & promotions is NOT:**
|
|
13
|
+
- The product price itself or its description/image → see **Catalog** (those are product fields).
|
|
14
|
+
- A standing $0 shipping option/region rate → see **Shipping & fulfillment**.
|
|
15
|
+
- Refunding a previous discounted order → route to verified Get Paid/payment docs or Dashboard guidance.
|
|
16
|
+
|
|
17
|
+
> **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.
|
|
18
|
+
>
|
|
19
|
+
> **Promotion dispatch.** Score each entry below by (a) the merchant's query → `intent:*` tags, (b) MerchantContext → context tags. Load the **highest-scoring** entry. Ties → highest `priority`. No match → follow the base recipe at the bottom.
|
|
20
|
+
>
|
|
21
|
+
> **Do not fall back to legacy `setup-*` or `flow-*` pricing slugs.** The skills below replaced earlier `…/skills/setup-coupons` and `…/skills/flow-<name>` articles during the routing-tree migration. If a slug below returns a transient 404 (rawdocs ingestion delay), **retry the same URL after a brief pause** — do NOT load any `setup-coupons` or `flow-*` legacy version even if it appears in the WixREADME index; that content is stale pre-migration material that contradicts this dispatcher.
|
|
22
|
+
|
|
23
|
+
### Actions — concrete operations
|
|
24
|
+
|
|
25
|
+
> - [Create coupon](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-coupon) — tags: `[intent:create-coupon]` · priority 0
|
|
26
|
+
> - [Create discount rule (auto-apply)](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) — tags: `[intent:create-discount-rule]` · priority 0
|
|
27
|
+
> - [Add sale ribbon / new ribbon](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) — tags: `[intent:add-ribbon]` · priority 0 · *ribbons are configured via Discount Rules; same recipe*
|
|
28
|
+
> - [Schedule a future sale](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) — tags: `[intent:schedule-sale]` · priority 0 · *uses Discount Rules with `startTime` in the future*
|
|
29
|
+
|
|
30
|
+
### Business flows — the orchestrator
|
|
31
|
+
|
|
32
|
+
The single business-flow orchestrator (`recommend-ecommerce-strategy`) handles all strategic discount intents. It classifies internally (SEASONAL / UPSELL_BOOST / STOCK_MOVER / BUNDLE_AND_SAVE / ABANDONED_CART) and loads its `goal-*` / `flow-*` support files from the kept ecommerce-root siblings.
|
|
33
|
+
|
|
34
|
+
> - [Run a sale / promotion strategy](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/recommend-e-commerce-strategy) — tags: `[intent:run-a-sale]` · priority 0
|
|
35
|
+
> - [Boost my business / increase sales](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/recommend-e-commerce-strategy) — tags: `[intent:boost-business]` · priority 0
|
|
36
|
+
> - [Seasonal / holiday promotion](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/recommend-e-commerce-strategy) — tags: `[intent:seasonal-promo]` · priority 0
|
|
37
|
+
> - [Clearance / move slow stock](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/recommend-e-commerce-strategy) — tags: `[intent:clearance]` · priority 0
|
|
38
|
+
> - [Increase AOV (bundle / upsell)](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/recommend-e-commerce-strategy) — tags: `[intent:increase-aov]` · priority 0
|
|
39
|
+
>
|
|
40
|
+
> **If the orchestrator above returns a 404** — do not stop. Classify the merchant intent directly and load the matching goal skill via `ReadFullDocsArticle`, then follow its routing chain into the flow skill:
|
|
41
|
+
> - Holiday / event / date mentioned (SEASONAL — takes priority over all other signals) → [Goal: Seasonal Revenue](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/goal-seasonal-revenue)
|
|
42
|
+
> - "Boost sales", "increase AOV", "upsell", "spend more" (UPSELL_BOOST) → [Goal: Increase AOV](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/goal-increase-aov)
|
|
43
|
+
> - "Clearance", "slow stock", "overstock", "move inventory" (STOCK_MOVER) → [Goal: Clear Inventory](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/goal-clear-inventory)
|
|
44
|
+
> - "Bundle", "cross-sell", "buy together", "more items per order" (BUNDLE_AND_SAVE) → [Goal: Drive Cross-Sells](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/goal-drive-cross-sells)
|
|
45
|
+
|
|
46
|
+
### Info / troubleshoot / recommendation
|
|
47
|
+
|
|
48
|
+
> - [Discount not applying — diagnose](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-discount-not-applying) — tags: `[intent:troubleshoot]` · priority 0
|
|
49
|
+
> - [View active discounts (Coupons API)](https://dev.wix.com/docs/api-reference/business-solutions/coupons/coupons/query-coupons) — tags: `[intent:view-active-discounts]` · priority 0 · **API doc, no skill** (per §7.5)
|
|
50
|
+
> - [View active discounts (Discount Rules API)](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/discount-rules/query-discount-rules) — tags: `[intent:view-active-rules]` · priority 0 · **API doc, no skill**
|
|
51
|
+
> - [Coupon usage stats](https://dev.wix.com/docs/api-reference/business-solutions/coupons/coupons/get-coupon-usage) — tags: `[intent:coupon-usage-stats]` · priority 0 · **API doc, no skill**
|
|
52
|
+
> - Competitive pricing check (how do my prices compare?) — tags: `[intent:competitive-pricing]` · *no Wix API for competitor data — advise the merchant to benchmark externally (Google Shopping / market research); Wix only exposes their own catalog prices via Catalog API*
|
|
53
|
+
|
|
54
|
+
### Cross-category routes (handled in another category)
|
|
55
|
+
|
|
56
|
+
> - [Change product price](https://dev.wix.com/docs/api-reference/business-solutions/stores/products-v3/update-product) — tags: `[intent:change-price]` · *price is a product field — Catalog API*
|
|
57
|
+
> - [Set compare-at price](https://dev.wix.com/docs/api-reference/business-solutions/stores/products-v3/update-product) — tags: `[intent:set-compare-at]` · *Catalog*
|
|
58
|
+
> - [Free shipping over $X (promo rule)](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/pricing-create-discount-rule) — tags: `[intent:free-shipping-promo]` · *belongs here as a promo rule; a $0 shipping rate is Shipping*
|
|
59
|
+
|
|
60
|
+
## Tag matching
|
|
61
|
+
|
|
62
|
+
The agent matches the merchant's natural-language query to an `intent:*` tag (cues are in each promotion file's `description`), AND matches MerchantContext to any context tags. A promotion's tags must ALL be satisfied for it to be eligible. Among eligible promotions, the one with the highest tag-count wins; ties broken by `priority`.
|
|
63
|
+
|
|
64
|
+
### Worked examples
|
|
65
|
+
|
|
66
|
+
| Merchant query | MerchantContext | Match |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| "Create a 20% off coupon" | any | `ecom-pricing-create-coupon` via `[intent:create-coupon]` |
|
|
69
|
+
| "Run a Black Friday sale" | any | `recommend-ecommerce-strategy` via `[intent:run-a-sale]` (orchestrator classifies as SEASONAL internally) |
|
|
70
|
+
| "Help me boost my sales" | any | `recommend-ecommerce-strategy` via `[intent:boost-business]` |
|
|
71
|
+
| "My coupon code XMAS isn't working" | any | `ecom-pricing-troubleshoot-not-applying` |
|
|
72
|
+
| "Show me my active discounts" | any | `query-coupons` API doc (no skill — per §7.5) |
|
|
73
|
+
| "Change the price of product Y" | any | Catalog cross-route (re-dispatch to Catalog when that category exists) |
|
|
74
|
+
|
|
75
|
+
## Base recipe (fallback)
|
|
76
|
+
|
|
77
|
+
If nothing matches, the merchant query is too vague. Ask **one** clarifying question:
|
|
78
|
+
|
|
79
|
+
> "Do you want to (a) **create** a specific discount/coupon now, (b) **strategize** a sale or promotion campaign, or (c) **fix** a discount that isn't applying?"
|
|
80
|
+
|
|
81
|
+
Map the answer → re-dispatch:
|
|
82
|
+
- (a) → `ecom-pricing-create-coupon` (default for "create a discount")
|
|
83
|
+
- (b) → `recommend-ecommerce-strategy`
|
|
84
|
+
- (c) → `ecom-pricing-troubleshoot-not-applying`
|
|
@@ -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: "
|
|
3
|
-
description:
|
|
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
|
-
#
|
|
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: "
|
|
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`
|