@wix/agent-skills 1.0.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/LICENSE +21 -0
- package/README.md +111 -0
- package/package.json +29 -0
- package/skills/wix-app/SKILL.md +344 -0
- package/skills/wix-app/references/APP_IDENTIFIERS.md +35 -0
- package/skills/wix-app/references/APP_MARKET_REVIEW.md +311 -0
- package/skills/wix-app/references/APP_VALIDATION.md +171 -0
- package/skills/wix-app/references/BACKEND_API.md +233 -0
- package/skills/wix-app/references/BACKEND_EVENT.md +116 -0
- package/skills/wix-app/references/CODE_QUALITY.md +33 -0
- package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +587 -0
- package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +157 -0
- package/skills/wix-app/references/DASHBOARD_MODAL.md +283 -0
- package/skills/wix-app/references/DASHBOARD_PAGE.md +403 -0
- package/skills/wix-app/references/DASHBOARD_PLUGIN.md +205 -0
- package/skills/wix-app/references/DATA_COLLECTION.md +451 -0
- package/skills/wix-app/references/DOCUMENTATION.md +42 -0
- package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +65 -0
- package/skills/wix-app/references/EMBEDDED_SCRIPT.md +468 -0
- package/skills/wix-app/references/EXTENSION_REGISTRATION.md +96 -0
- package/skills/wix-app/references/SERVICE_PLUGIN.md +235 -0
- package/skills/wix-app/references/SITE_PLUGIN.md +436 -0
- package/skills/wix-app/references/STORES_VERSIONING.md +334 -0
- package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +84 -0
- package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +345 -0
- package/skills/wix-app/references/dashboard-menu-plugin/blog-slots.md +71 -0
- package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +58 -0
- package/skills/wix-app/references/dashboard-menu-plugin/crm-slots.md +8 -0
- package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +17 -0
- package/skills/wix-app/references/dashboard-menu-plugin/events-slots.md +29 -0
- package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +27 -0
- package/skills/wix-app/references/dashboard-menu-plugin/stores-slots.md +35 -0
- package/skills/wix-app/references/dashboard-page/API_SPEC.md +138 -0
- package/skills/wix-app/references/dashboard-page/DASHBOARD_API.md +573 -0
- package/skills/wix-app/references/dashboard-page/DYNAMIC_PARAMETERS.md +269 -0
- package/skills/wix-app/references/dashboard-page/ECOM_NAVIGATION.md +164 -0
- package/skills/wix-app/references/dashboard-plugin/SLOTS.md +294 -0
- package/skills/wix-app/references/data-collection/WIX_DATA.md +270 -0
- package/skills/wix-app/references/data-collection/extension-template.ts +107 -0
- package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +138 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +454 -0
- package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +165 -0
- package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +576 -0
- package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +170 -0
- package/skills/wix-app/references/editor-react-component/EDIT-FLOW.md +6 -0
- package/skills/wix-app/references/editor-react-component/PARTS.md +25 -0
- package/skills/wix-app/references/editor-react-component/PROPS-VS-CSS.md +203 -0
- package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +167 -0
- package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +137 -0
- package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +112 -0
- package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +118 -0
- package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +87 -0
- package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +86 -0
- package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +135 -0
- package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +79 -0
- package/skills/wix-app/references/service-plugin/VALIDATIONS.md +68 -0
- package/skills/wix-app/references/site-plugin/EXAMPLES.md +311 -0
- package/skills/wix-app/references/site-plugin/SLOTS.md +263 -0
- package/skills/wix-design-system/SKILL.md +129 -0
- package/skills/wix-design-system/references/file-structure.md +56 -0
- package/skills/wix-design-system/scripts/wds.cjs +531 -0
- package/skills/wix-headless/SKILL.md +418 -0
- package/skills/wix-headless/references/DISCOVERY.md +332 -0
- package/skills/wix-headless/references/ORCHESTRATION.md +269 -0
- package/skills/wix-headless/references/SETUP.md +154 -0
- package/skills/wix-headless/references/blog/BLOG_CONTENT.md +152 -0
- package/skills/wix-headless/references/blog/BLOG_PAGES.md +299 -0
- package/skills/wix-headless/references/blog/BLOG_SETUP.md +218 -0
- package/skills/wix-headless/references/blog/INSTRUCTIONS.md +32 -0
- package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +373 -0
- package/skills/wix-headless/references/cms/FAQ_KNOWLEDGE_BASE.md +229 -0
- package/skills/wix-headless/references/cms/INSTRUCTIONS.md +40 -0
- package/skills/wix-headless/references/cms/PORTFOLIO.md +454 -0
- package/skills/wix-headless/references/cms/RESOURCE_LIBRARY.md +356 -0
- package/skills/wix-headless/references/cms/TEAM_DIRECTORY.md +299 -0
- package/skills/wix-headless/references/commands/install-app.md +42 -0
- package/skills/wix-headless/references/commands/known-apps.json +5 -0
- package/skills/wix-headless/references/commands/mcp-bootstrap.md +28 -0
- package/skills/wix-headless/references/designer/INSTRUCTIONS.md +828 -0
- package/skills/wix-headless/references/ecom/CART_PAGES.md +120 -0
- package/skills/wix-headless/references/ecom/CART_WIRING.md +103 -0
- package/skills/wix-headless/references/ecom/COMPONENTS_CSS.md +132 -0
- package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +59 -0
- package/skills/wix-headless/references/forms/CONTACT_FORM.md +477 -0
- package/skills/wix-headless/references/forms/INSTRUCTIONS.md +43 -0
- package/skills/wix-headless/references/gift-cards/COMPONENTS.md +119 -0
- package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +51 -0
- package/skills/wix-headless/references/gift-cards/PAGES.md +129 -0
- package/skills/wix-headless/references/images/INSTRUCTIONS.md +359 -0
- package/skills/wix-headless/references/shared/BUILD_NOISE.md +8 -0
- package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +185 -0
- package/skills/wix-headless/references/shared/IMPLEMENTER.md +155 -0
- package/skills/wix-headless/references/shared/MCP_PREFIX.md +105 -0
- package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +97 -0
- package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +423 -0
- package/skills/wix-headless/references/shared/STYLING.md +117 -0
- package/skills/wix-headless/references/stores/BACK_IN_STOCK.md +178 -0
- package/skills/wix-headless/references/stores/CATEGORY_PAGES.md +86 -0
- package/skills/wix-headless/references/stores/COMPONENTS_CSS.md +129 -0
- package/skills/wix-headless/references/stores/HOME_AND_NAV.md +227 -0
- package/skills/wix-headless/references/stores/INSTRUCTIONS.md +96 -0
- package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +249 -0
- package/skills/wix-headless/references/stores/PRODUCT_PAGES.md +213 -0
- package/skills/wix-headless/references/stores/SHARED_WIRING.md +164 -0
- package/skills/wix-headless/references/verticals/_schema.json +160 -0
- package/skills/wix-headless/references/verticals/_schema.md +185 -0
- package/skills/wix-headless/references/verticals/blog.md +125 -0
- package/skills/wix-headless/references/verticals/cms.md +121 -0
- package/skills/wix-headless/references/verticals/ecom.md +96 -0
- package/skills/wix-headless/references/verticals/forms.md +106 -0
- package/skills/wix-headless/references/verticals/gift-cards.md +121 -0
- package/skills/wix-headless/references/verticals/stores.md +167 -0
- package/skills/wix-headless/scripts/check-manifest.mjs +198 -0
- package/skills/wix-headless/scripts/copy-utility-templates.mjs +153 -0
- package/skills/wix-headless/scripts/emit-design-tokens.mjs +77 -0
- package/skills/wix-headless/scripts/finalize-run-json.mjs +141 -0
- package/skills/wix-headless/scripts/init-site-json.mjs +63 -0
- package/skills/wix-headless/scripts/patch-decorative-slots.mjs +124 -0
- package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +190 -0
- package/skills/wix-headless/scripts/preview.sh +45 -0
- package/skills/wix-headless/scripts/release.sh +73 -0
- package/skills/wix-headless/scripts/scaffold.sh +53 -0
- package/skills/wix-headless/scripts/seed-utilities.sh +55 -0
- package/skills/wix-headless/shared-utilities/analytics.ts +40 -0
- package/skills/wix-headless/shared-utilities/ricos.ts +179 -0
- package/skills/wix-headless/shared-utilities/wix-image.ts +72 -0
- package/skills/wix-headless/templates/ecom/CartBadge.tsx +84 -0
- package/skills/wix-headless/templates/ecom/CartView.tsx +543 -0
- package/skills/wix-headless/templates/ecom/cart.astro +13 -0
- package/skills/wix-headless/templates/ecom/components-ecom.css +215 -0
- package/skills/wix-headless/templates/ecom/discounts.ts +71 -0
- package/skills/wix-headless/templates/ecom/thank-you.astro +24 -0
- package/skills/wix-headless/templates/gift-cards/GiftCardPurchase.tsx +172 -0
- package/skills/wix-headless/templates/gift-cards/_home-teaser-snippet.astro +42 -0
- package/skills/wix-headless/templates/gift-cards/_nav-snippet.astro +11 -0
- package/skills/wix-headless/templates/gift-cards/components-gift-cards.css +219 -0
- package/skills/wix-headless/templates/gift-cards/gift-cards.astro +51 -0
- package/skills/wix-headless/templates/gift-cards/gift-cards.ts +75 -0
- package/skills/wix-headless/templates/stores/AddToCartButton.tsx +77 -0
- package/skills/wix-headless/templates/stores/BackInStockForm.tsx +176 -0
- package/skills/wix-headless/templates/stores/CategoryRail.astro +69 -0
- package/skills/wix-headless/templates/stores/ProductCard.astro +79 -0
- package/skills/wix-headless/templates/stores/ProductPurchase.tsx +397 -0
- package/skills/wix-headless/templates/stores/SeoTags.astro +21 -0
- package/skills/wix-headless/templates/stores/back-in-stock.ts +67 -0
- package/skills/wix-headless/templates/stores/categories.ts +155 -0
- package/skills/wix-headless/templates/stores/category/[slug].astro +130 -0
- package/skills/wix-headless/templates/stores/components-stores.css +295 -0
- package/skills/wix-headless/templates/stores/products/[slug].astro +128 -0
- package/skills/wix-headless/templates/stores/products/index.astro +101 -0
- package/skills/wix-manage/SKILL.md +280 -0
- package/skills/wix-manage/references/app-installation/install-wix-apps.md +155 -0
- package/skills/wix-manage/references/app-installation/list-installed-apps.md +124 -0
- package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +226 -0
- package/skills/wix-manage/references/bookings/booking-service-policy-setup.md +95 -0
- package/skills/wix-manage/references/bookings/booking-system-integration-gaps.md +416 -0
- package/skills/wix-manage/references/bookings/bookings-staff-setup.md +255 -0
- package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +462 -0
- package/skills/wix-manage/references/bookings/end-to-end-booking-flow.md +278 -0
- package/skills/wix-manage/references/bookings/external-calendar-integration.md +258 -0
- package/skills/wix-manage/references/bookings/multi-resource-service-creation.md +231 -0
- package/skills/wix-manage/references/calendar/configure-default-business-hours.md +226 -0
- package/skills/wix-manage/references/cms/cms-data-items-crud.md +422 -0
- package/skills/wix-manage/references/cms/cms-data-operations-extended.md +263 -0
- package/skills/wix-manage/references/cms/cms-ecommerce-catalog-integration.md +136 -0
- package/skills/wix-manage/references/cms/cms-references-and-relationships.md +160 -0
- package/skills/wix-manage/references/cms/cms-schema-management.md +143 -0
- package/skills/wix-manage/references/contacts/bulk-delete-contacts.md +73 -0
- package/skills/wix-manage/references/contacts/bulk-label-and-unlabel-contacts.md +67 -0
- package/skills/wix-manage/references/domains/domain-search-and-purchase.md +434 -0
- package/skills/wix-manage/references/ecommerce/api-recommendation-tracking.md +420 -0
- package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +267 -0
- package/skills/wix-manage/references/ecommerce/flow-bundle-and-save.md +290 -0
- package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +300 -0
- package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +364 -0
- package/skills/wix-manage/references/ecommerce/flow-seasonal-promotion.md +315 -0
- package/skills/wix-manage/references/ecommerce/flow-stock-mover.md +308 -0
- package/skills/wix-manage/references/ecommerce/flow-upsell-boost.md +271 -0
- package/skills/wix-manage/references/ecommerce/goal-clear-inventory.md +118 -0
- package/skills/wix-manage/references/ecommerce/goal-drive-cross-sells.md +122 -0
- package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +132 -0
- package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +148 -0
- package/skills/wix-manage/references/ecommerce/goal-seasonal-revenue.md +146 -0
- package/skills/wix-manage/references/ecommerce/guardrail-discount-conflicts.md +118 -0
- package/skills/wix-manage/references/ecommerce/guardrail-margin-protection.md +88 -0
- package/skills/wix-manage/references/ecommerce/guardrail-rate-pricing-sanity.md +108 -0
- package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +124 -0
- package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +299 -0
- package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +582 -0
- package/skills/wix-manage/references/ecommerce/setup-coupons.md +338 -0
- package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +444 -0
- package/skills/wix-manage/references/ecommerce/setup-shipping-rates.md +86 -0
- package/skills/wix-manage/references/ecommerce/setup-shipping-regions.md +56 -0
- package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +209 -0
- package/skills/wix-manage/references/ecommerce/skill-graph.md +139 -0
- package/skills/wix-manage/references/ecommerce/troubleshoot-checkout-delivery-dropoff.md +124 -0
- package/skills/wix-manage/references/ecommerce/troubleshoot-discount-not-applying.md +95 -0
- package/skills/wix-manage/references/events/list-events.md +203 -0
- package/skills/wix-manage/references/forms/create-form.md +260 -0
- package/skills/wix-manage/references/get-paid/create-payment-links.md +212 -0
- package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +57 -0
- package/skills/wix-manage/references/get-paid/payment-links-for-bookings.md +101 -0
- package/skills/wix-manage/references/media/upload-media-to-wix.md +216 -0
- package/skills/wix-manage/references/pricing-plans/create-and-update-pricing-plans.md +77 -0
- package/skills/wix-manage/references/pricing-plans/pricing-plans-bookings-integration.md +166 -0
- package/skills/wix-manage/references/restaurants/wix-restaurants-setup.md +336 -0
- package/skills/wix-manage/references/rich-content/ricos-converter-service.md +295 -0
- package/skills/wix-manage/references/site-properties/change-payment-currency-site-properties.md +59 -0
- package/skills/wix-manage/references/sites/create-site-from-template.md +183 -0
- package/skills/wix-manage/references/sites/query-sites.md +125 -0
- package/skills/wix-manage/references/stores/add-store-pages-to-site.md +57 -0
- package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +1041 -0
- package/skills/wix-manage/references/stores/create-product-catalog-v1.md +125 -0
- package/skills/wix-manage/references/stores/create-product-from-image.md +824 -0
- package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +566 -0
- package/skills/wix-manage/references/stores/find-products-query-and-search-catalog-v3.md +194 -0
- package/skills/wix-manage/references/stores/query-products-catalog-v1.md +80 -0
- package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +99 -0
- package/skills/wix-manage/references/stores/update-product-pre-order.md +213 -0
- package/skills/wix-manage/references/stores/update-product-with-options.md +318 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "Flow: Optimize Shipping Rates"
|
|
3
|
+
description: Analyzes catalog price distribution and current rate structure to recommend optimal shipping rate strategy. Handles flat-to-tiered conversion, tier gap detection, and per-item penalty removal.
|
|
4
|
+
layer: flow
|
|
5
|
+
references:
|
|
6
|
+
- name: "Guardrail: Rate Pricing Sanity"
|
|
7
|
+
path: ecommerce/guardrail-rate-pricing-sanity.md
|
|
8
|
+
load: true
|
|
9
|
+
- name: "Setup: Shipping Rates"
|
|
10
|
+
path: ecommerce/setup-shipping-rates.md
|
|
11
|
+
load: true
|
|
12
|
+
---
|
|
13
|
+
# Flow: Optimize Shipping Rates
|
|
14
|
+
|
|
15
|
+
> **Before executing this skill**, read these referenced skills with `ReadFullDocsArticle`:
|
|
16
|
+
> - [Guardrail: Rate Pricing Sanity](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/guardrail-rate-pricing-sanity)
|
|
17
|
+
> - [Setup: Shipping Rates](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/skills/setup-shipping-rates)
|
|
18
|
+
|
|
19
|
+
Analyzes the site's catalog price distribution and current shipping rate structure to determine if the rate strategy is optimal. Recommends and applies changes when flat rates should become tiered, when tier gaps exist, or when per-item penalties are harming conversion.
|
|
20
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
- Wix Stores (or another eCommerce business solution) installed on the site
|
|
24
|
+
- Catalog stats available (product_count, price quantiles, price_stddev)
|
|
25
|
+
- Site metrics available for AOV calculation
|
|
26
|
+
- At least one shipping option configured
|
|
27
|
+
|
|
28
|
+
## Required APIs
|
|
29
|
+
|
|
30
|
+
- [Query Shipping Options](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/shipping-delivery/shipping-options/query-shipping-options)
|
|
31
|
+
- [Update Shipping Option](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/shipping-delivery/shipping-options/update-shipping-option)
|
|
32
|
+
- [Create Shipping Option](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/shipping-delivery/shipping-options/create-shipping-option)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Step 1: Gather catalog price distribution
|
|
37
|
+
|
|
38
|
+
Retrieve catalog statistics for the "All Products" category group. Required fields:
|
|
39
|
+
|
|
40
|
+
| Metric | Description |
|
|
41
|
+
|---|---|
|
|
42
|
+
| `product_count` | Total number of products |
|
|
43
|
+
| `price_min` | Lowest product price |
|
|
44
|
+
| `price_max` | Highest product price |
|
|
45
|
+
| `price_avg` | Average product price |
|
|
46
|
+
| `price_stddev` | Standard deviation of prices |
|
|
47
|
+
| `price_p25` | 25th percentile price |
|
|
48
|
+
| `price_p50` | 50th percentile (median) price |
|
|
49
|
+
| `price_p75` | 75th percentile price |
|
|
50
|
+
| `price_p90` | 90th percentile price |
|
|
51
|
+
|
|
52
|
+
### 1a: Calculate price spread ratio
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
price_spread_ratio = price_max / price_min
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This ratio indicates how diverse the catalog pricing is. A ratio of 3 means the most expensive product is 3x the cheapest; a ratio of 50 means extreme price diversity.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Step 2: Query current shipping options
|
|
63
|
+
|
|
64
|
+
Retrieve all shipping options to analyze the existing rate structure.
|
|
65
|
+
|
|
66
|
+
**Endpoint**: `POST https://www.wixapis.com/ecom/v1/shipping-options/query`
|
|
67
|
+
|
|
68
|
+
**Request**:
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"query": {
|
|
72
|
+
"cursorPaging": {
|
|
73
|
+
"limit": 100
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Response**:
|
|
80
|
+
```json
|
|
81
|
+
{
|
|
82
|
+
"shippingOptions": [
|
|
83
|
+
{
|
|
84
|
+
"id": "c0e5be8f-5266-4720-a732-5f571e4750db",
|
|
85
|
+
"revision": "1",
|
|
86
|
+
"deliveryRegionId": "42b0ed3b-fc54-4ac0-89cf-5d2d17ec441c",
|
|
87
|
+
"deliveryRegionIds": [],
|
|
88
|
+
"title": "Standard Shipping",
|
|
89
|
+
"estimatedDeliveryTime": "5-7 business days",
|
|
90
|
+
"rates": [
|
|
91
|
+
{
|
|
92
|
+
"amount": "15.00",
|
|
93
|
+
"conditions": [],
|
|
94
|
+
"multiplyByQuantity": false
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
],
|
|
99
|
+
"pagingMetadata": {
|
|
100
|
+
"count": 1,
|
|
101
|
+
"cursors": {},
|
|
102
|
+
"hasNext": false
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
For each option, classify its rate structure:
|
|
108
|
+
- **Flat rate**: `conditions[]` is empty
|
|
109
|
+
- **Tiered**: Multiple rates with `BY_TOTAL_PRICE`, `BY_TOTAL_WEIGHT`, or `BY_TOTAL_QUANTITY` conditions
|
|
110
|
+
- **Free shipping**: `amount="0"`
|
|
111
|
+
- **Per-item**: `multiplyByQuantity=true`
|
|
112
|
+
|
|
113
|
+
---
|
|
114
|
+
|
|
115
|
+
## Step 3: Apply the rate strategy decision tree
|
|
116
|
+
|
|
117
|
+
### 3a: Check for per-item penalty (highest priority)
|
|
118
|
+
|
|
119
|
+
If any shipping option has `multiplyByQuantity=true`, flag it immediately.
|
|
120
|
+
|
|
121
|
+
**Problem**: Per-item charging means shipping cost = `amount x cart quantity`. A $5 rate on a 5-item order charges $25 for shipping. This discourages larger carts and directly conflicts with AOV growth goals.
|
|
122
|
+
|
|
123
|
+
**Recommendation**: Switch to flat rate or tiered pricing. Update the option to set `multiplyByQuantity=false`.
|
|
124
|
+
|
|
125
|
+
### 3b: Evaluate flat-to-tiered conversion
|
|
126
|
+
|
|
127
|
+
Check ALL three conditions. If all are true, recommend converting flat rates to price-based tiers:
|
|
128
|
+
|
|
129
|
+
| Condition | Threshold |
|
|
130
|
+
|---|---|
|
|
131
|
+
| `price_spread_ratio > 10` | Catalog has extreme price diversity |
|
|
132
|
+
| `price_stddev > price_avg x 0.5` | High variance in pricing |
|
|
133
|
+
| Only flat rates currently exist | No tiered structure in place |
|
|
134
|
+
|
|
135
|
+
**If all three conditions are met**, recommend price-based tiers:
|
|
136
|
+
|
|
137
|
+
| Tier | Price Range | Rate Strategy |
|
|
138
|
+
|---|---|---|
|
|
139
|
+
| Tier 1 | Orders below `price_p50` | Lower flat rate |
|
|
140
|
+
| Tier 2 | Orders `price_p50` to `price_p75` | Standard rate |
|
|
141
|
+
| Tier 3 | Orders above `price_p75` | Higher rate or free shipping |
|
|
142
|
+
|
|
143
|
+
### 3c: Confirm flat rate is optimal
|
|
144
|
+
|
|
145
|
+
If ALL of the following are true, flat rate is the correct strategy -- no changes needed:
|
|
146
|
+
|
|
147
|
+
| Condition | Threshold |
|
|
148
|
+
|---|---|
|
|
149
|
+
| `price_spread_ratio <= 3` | Narrow price range |
|
|
150
|
+
| `price_stddev < price_avg x 0.3` | Low variance |
|
|
151
|
+
|
|
152
|
+
Report: "Your catalog has a narrow price range. Flat rate shipping is the optimal strategy. No changes recommended."
|
|
153
|
+
|
|
154
|
+
### 3d: Check for tier gaps in existing tiered options
|
|
155
|
+
|
|
156
|
+
For options that already use tiered pricing (weight-based or price-based conditions):
|
|
157
|
+
|
|
158
|
+
1. Sort all rates by their condition `value`
|
|
159
|
+
2. Look for gaps between tier boundaries
|
|
160
|
+
|
|
161
|
+
**Example gap**: Tier 1 has `LTE 5` (kg or $), Tier 2 has `GT 10`. A cart at 7 matches neither tier and gets no shipping rate for this option.
|
|
162
|
+
|
|
163
|
+
**Fix**: Adjust condition boundaries to ensure complete, contiguous coverage.
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Step 4: Apply recommended changes
|
|
168
|
+
|
|
169
|
+
### 4a: Fix per-item penalty
|
|
170
|
+
|
|
171
|
+
Update the shipping option to disable per-item multiplication.
|
|
172
|
+
|
|
173
|
+
**Endpoint**: `PATCH https://www.wixapis.com/ecom/v1/shipping-options/{shippingOptionId}`
|
|
174
|
+
|
|
175
|
+
**Request**:
|
|
176
|
+
```json
|
|
177
|
+
{
|
|
178
|
+
"shippingOption": {
|
|
179
|
+
"id": "c0e5be8f-5266-4720-a732-5f571e4750db",
|
|
180
|
+
"revision": "1",
|
|
181
|
+
"title": "Standard Shipping",
|
|
182
|
+
"estimatedDeliveryTime": "5-7 business days",
|
|
183
|
+
"rates": [
|
|
184
|
+
{
|
|
185
|
+
"amount": "9.99",
|
|
186
|
+
"multiplyByQuantity": false,
|
|
187
|
+
"conditions": []
|
|
188
|
+
}
|
|
189
|
+
]
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
**Response**:
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"shippingOption": {
|
|
198
|
+
"id": "c0e5be8f-5266-4720-a732-5f571e4750db",
|
|
199
|
+
"revision": "2",
|
|
200
|
+
"createdDate": "2026-04-14T14:43:24.804Z",
|
|
201
|
+
"updatedDate": "2026-04-15T13:14:13.716Z",
|
|
202
|
+
"deliveryRegionId": "42b0ed3b-fc54-4ac0-89cf-5d2d17ec441c",
|
|
203
|
+
"deliveryRegionIds": [],
|
|
204
|
+
"title": "Standard Shipping",
|
|
205
|
+
"estimatedDeliveryTime": "5-7 business days",
|
|
206
|
+
"rates": [
|
|
207
|
+
{
|
|
208
|
+
"amount": "9.99",
|
|
209
|
+
"conditions": [],
|
|
210
|
+
"multiplyByQuantity": false
|
|
211
|
+
}
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### 4b: Create tiered shipping option
|
|
218
|
+
|
|
219
|
+
When converting from flat to tiered, create a new option with price-based tiers. Use catalog quantiles to set tier boundaries.
|
|
220
|
+
|
|
221
|
+
**Example** with `price_p50=$35`, `price_p75=$80`:
|
|
222
|
+
|
|
223
|
+
**Endpoint**: `POST https://www.wixapis.com/ecom/v1/shipping-options`
|
|
224
|
+
|
|
225
|
+
**Request**:
|
|
226
|
+
```json
|
|
227
|
+
{
|
|
228
|
+
"shippingOption": {
|
|
229
|
+
"title": "Standard Shipping",
|
|
230
|
+
"estimatedDeliveryTime": "5-7 business days",
|
|
231
|
+
"deliveryRegionId": "42b0ed3b-fc54-4ac0-89cf-5d2d17ec441c",
|
|
232
|
+
"rates": [
|
|
233
|
+
{
|
|
234
|
+
"amount": "9.99",
|
|
235
|
+
"multiplyByQuantity": false,
|
|
236
|
+
"conditions": [
|
|
237
|
+
{
|
|
238
|
+
"type": "BY_TOTAL_PRICE",
|
|
239
|
+
"operator": "LTE",
|
|
240
|
+
"value": "35"
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"amount": "7.99",
|
|
246
|
+
"multiplyByQuantity": false,
|
|
247
|
+
"conditions": [
|
|
248
|
+
{
|
|
249
|
+
"type": "BY_TOTAL_PRICE",
|
|
250
|
+
"operator": "GT",
|
|
251
|
+
"value": "35"
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
"type": "BY_TOTAL_PRICE",
|
|
255
|
+
"operator": "LTE",
|
|
256
|
+
"value": "80"
|
|
257
|
+
}
|
|
258
|
+
]
|
|
259
|
+
},
|
|
260
|
+
{
|
|
261
|
+
"amount": "0",
|
|
262
|
+
"multiplyByQuantity": false,
|
|
263
|
+
"conditions": [
|
|
264
|
+
{
|
|
265
|
+
"type": "BY_TOTAL_PRICE",
|
|
266
|
+
"operator": "GT",
|
|
267
|
+
"value": "80"
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
]
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Response**:
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"shippingOption": {
|
|
280
|
+
"id": "f3a4b5c6-d7e8-9012-fghi-345678901def",
|
|
281
|
+
"revision": "1",
|
|
282
|
+
"createdDate": "2026-04-15T14:00:00.000Z",
|
|
283
|
+
"updatedDate": "2026-04-15T14:00:00.000Z",
|
|
284
|
+
"deliveryRegionId": "42b0ed3b-fc54-4ac0-89cf-5d2d17ec441c",
|
|
285
|
+
"deliveryRegionIds": [],
|
|
286
|
+
"title": "Standard Shipping",
|
|
287
|
+
"estimatedDeliveryTime": "5-7 business days",
|
|
288
|
+
"rates": [
|
|
289
|
+
{
|
|
290
|
+
"amount": "9.99",
|
|
291
|
+
"conditions": [
|
|
292
|
+
{
|
|
293
|
+
"type": "BY_TOTAL_PRICE",
|
|
294
|
+
"operator": "LTE",
|
|
295
|
+
"value": "35"
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
"multiplyByQuantity": false
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"amount": "7.99",
|
|
302
|
+
"conditions": [
|
|
303
|
+
{
|
|
304
|
+
"type": "BY_TOTAL_PRICE",
|
|
305
|
+
"operator": "GT",
|
|
306
|
+
"value": "35"
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"type": "BY_TOTAL_PRICE",
|
|
310
|
+
"operator": "LTE",
|
|
311
|
+
"value": "80"
|
|
312
|
+
}
|
|
313
|
+
],
|
|
314
|
+
"multiplyByQuantity": false
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
"amount": "0",
|
|
318
|
+
"conditions": [
|
|
319
|
+
{
|
|
320
|
+
"type": "BY_TOTAL_PRICE",
|
|
321
|
+
"operator": "GT",
|
|
322
|
+
"value": "80"
|
|
323
|
+
}
|
|
324
|
+
],
|
|
325
|
+
"multiplyByQuantity": false
|
|
326
|
+
}
|
|
327
|
+
]
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
**Tier logic**: Multiple conditions within the same rate use AND logic. The middle tier (`GT 35 AND LTE 80`) matches cart totals between $35 and $80.
|
|
333
|
+
|
|
334
|
+
---
|
|
335
|
+
|
|
336
|
+
## Step 5: Verify updated rates
|
|
337
|
+
|
|
338
|
+
Re-query shipping options to confirm changes took effect.
|
|
339
|
+
|
|
340
|
+
**Endpoint**: `POST https://www.wixapis.com/ecom/v1/shipping-options/query`
|
|
341
|
+
|
|
342
|
+
Verify:
|
|
343
|
+
1. Per-item options now have `multiplyByQuantity=false`
|
|
344
|
+
2. Tiered options have contiguous tier boundaries with no gaps
|
|
345
|
+
3. All options have `estimatedDeliveryTime` populated
|
|
346
|
+
4. Rate amounts are reasonable (no single rate exceeds 15% of effective_aov)
|
|
347
|
+
5. Updated options show incremented `revision` values
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
## Error Handling
|
|
352
|
+
|
|
353
|
+
| Error | Cause | Fix |
|
|
354
|
+
|---|---|---|
|
|
355
|
+
| `SHIPPING_OPTION_NOT_FOUND` | Option ID doesn't exist | Re-query shipping options to get current IDs |
|
|
356
|
+
| `REVISION_MISMATCH` | Revision doesn't match the current version | Re-fetch the option for the latest revision, then retry |
|
|
357
|
+
| `deliveryRegionId is not a valid GUID` | Used `deliveryRegionIds` (plural) instead of `deliveryRegionId` (singular) | Use the singular `deliveryRegionId` field |
|
|
358
|
+
| Tier gap detected after update | Condition boundaries don't cover all ranges | Verify tier boundaries are contiguous: use LTE for upper bounds and GT for lower bounds of adjacent tiers |
|
|
359
|
+
| Rate exceeds 15% of AOV | Shipping cost is a cart abandonment risk | Lower the rate amount or add a free shipping tier for larger orders |
|
|
360
|
+
|
|
361
|
+
## References
|
|
362
|
+
|
|
363
|
+
- [Shipping Options API](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/shipping-delivery/shipping-options/introduction)
|
|
364
|
+
- [Delivery Profiles API](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/shipping-delivery/delivery-profiles/introduction)
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
---
|
|
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
|
|
12
|
+
---
|
|
13
|
+
# Flow: Seasonal Promotion
|
|
14
|
+
|
|
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)
|
|
18
|
+
|
|
19
|
+
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
|
+
|
|
21
|
+
## Prerequisites
|
|
22
|
+
|
|
23
|
+
- Wix Stores installed on the site
|
|
24
|
+
- Products exist in the catalog
|
|
25
|
+
- Access to `getCatalogAnalytics`, `getProductCatalogData`, and `getSiteData` tools
|
|
26
|
+
- `current_date` available for event scheduling
|
|
27
|
+
- Site `country` known for region-specific event mapping
|
|
28
|
+
|
|
29
|
+
## Required APIs
|
|
30
|
+
|
|
31
|
+
- [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/discounts/discount-rules/create-discount-rule)
|
|
32
|
+
- [Query Discount Rules](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/discounts/discount-rules/query-discount-rules)
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Step 1: Identify upcoming event
|
|
37
|
+
|
|
38
|
+
Use `current_date` and the site's `country` (from `getSiteData`) to identify major holidays or shopping events within the next 30 days.
|
|
39
|
+
|
|
40
|
+
### Common event calendar
|
|
41
|
+
|
|
42
|
+
| Event | Typical Date | Regions | Event-relevant categories |
|
|
43
|
+
|---|---|---|---|
|
|
44
|
+
| Valentine's Day | February 14 | Global | Gifts, Jewelry, Flowers, Fashion |
|
|
45
|
+
| Mother's Day | 2nd Sunday in May (US), March (UK) | Varies by country | Gifts, Home & Garden, Jewelry |
|
|
46
|
+
| Father's Day | 3rd Sunday in June (US) | Varies by country | Electronics, Tools, Fashion |
|
|
47
|
+
| Back to School | August-September | US, Global | School supplies, Kids, Fashion |
|
|
48
|
+
| Black Friday | 4th Friday in November | US, spreading globally | Electronics, Fashion, All categories |
|
|
49
|
+
| Cyber Monday | Monday after Black Friday | US, spreading globally | Electronics, Tech, All categories |
|
|
50
|
+
| Christmas | December 25 | Global (Christian-majority) | Gifts, Toys, Fashion, Home |
|
|
51
|
+
| Boxing Day | December 26 | UK, Canada, Australia | All categories (clearance) |
|
|
52
|
+
| New Year Sale | January 1-7 | Global | All categories (clearance) |
|
|
53
|
+
| Singles' Day | November 11 | China, spreading globally | Fashion, Electronics, Beauty |
|
|
54
|
+
|
|
55
|
+
If no event is within 30 days, inform the merchant and suggest either a general seasonal promotion or waiting for the next event.
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Step 2: Calculate campaign window
|
|
60
|
+
|
|
61
|
+
Determine the optimal start and end dates for the campaign based on the event date.
|
|
62
|
+
|
|
63
|
+
### Window calculation rules
|
|
64
|
+
|
|
65
|
+
- **Start date**: 3-5 days before the event date.
|
|
66
|
+
- **End date**: 1-3 days after the event (or through the following Tuesday for weekend events).
|
|
67
|
+
- **IMPORTANT**: If the calculated start date is before `current_date`, set start to `current_date`. Never schedule a campaign to start in the past.
|
|
68
|
+
|
|
69
|
+
### Examples
|
|
70
|
+
|
|
71
|
+
| Event | Event Date | Start | End | Notes |
|
|
72
|
+
|---|---|---|---|---|
|
|
73
|
+
| Valentine's Day | Feb 14 (Saturday) | Feb 10 (Tuesday) | Feb 16 (Monday) | Through the weekend after |
|
|
74
|
+
| Black Friday | Nov 27 (Friday) | Nov 23 (Monday) | Dec 1 (Tuesday) | Start Monday, end following Tuesday (covers Cyber Monday) |
|
|
75
|
+
| Cyber Monday | Nov 30 (Monday) | Nov 28 (Saturday) | Dec 1 (Tuesday) | Often combined with Black Friday window |
|
|
76
|
+
| Christmas | Dec 25 (Thursday) | Dec 20 (Saturday) | Dec 27 (Saturday) | Start ~5 days before, include Boxing Day |
|
|
77
|
+
| Mother's Day | May 10 (Sunday) | May 6 (Wednesday) | May 11 (Monday) | Through the day after |
|
|
78
|
+
|
|
79
|
+
### Combined events
|
|
80
|
+
|
|
81
|
+
For Black Friday + Cyber Monday, use a single extended window: start the preceding Monday/Tuesday, end the following Tuesday. Do not create two separate discount rules.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Step 3: Gather catalog data
|
|
86
|
+
|
|
87
|
+
Call `getCatalogAnalytics` and `getProductCatalogData` concurrently.
|
|
88
|
+
|
|
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.
|
|
100
|
+
|
|
101
|
+
Save the following values:
|
|
102
|
+
- `total_orders` — overall sales volume
|
|
103
|
+
- `price_p50`, `price_p90` — price distribution for discount sizing
|
|
104
|
+
- `avg_profit_margin` — sets discount ceiling
|
|
105
|
+
- Top products by sales volume
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Step 4: Focus on event-relevant categories
|
|
110
|
+
|
|
111
|
+
Map the identified event to relevant product categories:
|
|
112
|
+
|
|
113
|
+
| Event | Priority Categories | Fallback |
|
|
114
|
+
|---|---|---|
|
|
115
|
+
| Valentine's Day | Gifts, Jewelry, Flowers, Fashion | Site-wide |
|
|
116
|
+
| Black Friday / Cyber Monday | Electronics, Fashion, Home | Site-wide (broad event) |
|
|
117
|
+
| Christmas | Gifts, Toys, Home Decor, Fashion | Site-wide |
|
|
118
|
+
| Back to School | School Supplies, Kids, Fashion | Site-wide |
|
|
119
|
+
| Mother's Day / Father's Day | Gifts, relevant verticals | Site-wide |
|
|
120
|
+
|
|
121
|
+
If the merchant's catalog matches an event-relevant category, target that category specifically. If no clear match exists, use site-wide scope.
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Step 5: Create campaign name
|
|
126
|
+
|
|
127
|
+
Build a compelling campaign name using the event/period name:
|
|
128
|
+
|
|
129
|
+
| Event | Example Campaign Names |
|
|
130
|
+
|---|---|
|
|
131
|
+
| Black Friday | "Black Friday Flash Deal", "Black Friday Blowout" |
|
|
132
|
+
| Cyber Monday | "Cyber Monday Special", "Cyber Monday Deals" |
|
|
133
|
+
| Christmas | "Holiday Season Sale", "Christmas Gift Sale" |
|
|
134
|
+
| Valentine's Day | "Valentine's Day Special", "Love Day Sale" |
|
|
135
|
+
| New Year | "New Year Clearance", "Fresh Start Sale" |
|
|
136
|
+
| Generic seasonal | "Spring Sale", "Summer Savings", "Fall Collection Sale" |
|
|
137
|
+
|
|
138
|
+
Keep names concise and recognizable. The name is internal (not shown to customers in checkout) but helps merchants manage their promotions.
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Step 6: Determine discount scope
|
|
143
|
+
|
|
144
|
+
- **CATEGORY** (preferred for event-relevant promotions): Target the event-relevant category with the highest margin and product count.
|
|
145
|
+
- **SITE** (for broad events): Use for events like Black Friday where the expectation is store-wide deals.
|
|
146
|
+
|
|
147
|
+
Avoid ITEMS scope for seasonal campaigns — seasonal promotions are typically broad rather than targeting individual products.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Step 7: Convert category names to GUIDs (if CATEGORY scope)
|
|
152
|
+
|
|
153
|
+
If scope is CATEGORY, call `getCategoryIds` to convert category names to GUIDs.
|
|
154
|
+
|
|
155
|
+
- Never use category names as scope IDs — always use the GUID.
|
|
156
|
+
- Exclude the "All Products" system category.
|
|
157
|
+
- Max 3 categoryIds per discount rule.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Step 8: Run guardrail checks
|
|
162
|
+
|
|
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.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Step 9: Create the discount rule with campaign window
|
|
191
|
+
|
|
192
|
+
**Endpoint**: `POST https://www.wixapis.com/ecom/v1/discount-rules`
|
|
193
|
+
|
|
194
|
+
**Request** — Black Friday 20% off electronics category, Monday-Tuesday window:
|
|
195
|
+
```json
|
|
196
|
+
{
|
|
197
|
+
"discountRule": {
|
|
198
|
+
"name": "Black Friday Flash Deal",
|
|
199
|
+
"active": true,
|
|
200
|
+
"activeTimeInfo": {
|
|
201
|
+
"start": "2026-11-23T00:00:00.000Z",
|
|
202
|
+
"end": "2026-12-01T23:59:59.000Z"
|
|
203
|
+
},
|
|
204
|
+
"discounts": [
|
|
205
|
+
{
|
|
206
|
+
"discount": {
|
|
207
|
+
"discountType": "PERCENTAGE",
|
|
208
|
+
"percentage": 20
|
|
209
|
+
},
|
|
210
|
+
"scope": {
|
|
211
|
+
"id": "electronics-category-guid",
|
|
212
|
+
"type": "COLLECTION"
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
]
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
**Response**:
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"discountRule": {
|
|
224
|
+
"id": "f6a7b8c9-d0e1-2345-f012-456789012345",
|
|
225
|
+
"revision": "1",
|
|
226
|
+
"name": "Black Friday Flash Deal",
|
|
227
|
+
"active": true,
|
|
228
|
+
"activeTimeInfo": {
|
|
229
|
+
"start": "2026-11-23T00:00:00.000Z",
|
|
230
|
+
"end": "2026-12-01T23:59:59.000Z"
|
|
231
|
+
},
|
|
232
|
+
"discounts": [
|
|
233
|
+
{
|
|
234
|
+
"discount": {
|
|
235
|
+
"discountType": "PERCENTAGE",
|
|
236
|
+
"percentage": 20
|
|
237
|
+
},
|
|
238
|
+
"scope": {
|
|
239
|
+
"id": "electronics-category-guid",
|
|
240
|
+
"type": "COLLECTION"
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Request** — Valentine's Day site-wide 15% off:
|
|
249
|
+
```json
|
|
250
|
+
{
|
|
251
|
+
"discountRule": {
|
|
252
|
+
"name": "Valentine's Day Special",
|
|
253
|
+
"active": true,
|
|
254
|
+
"activeTimeInfo": {
|
|
255
|
+
"start": "2026-02-10T00:00:00.000Z",
|
|
256
|
+
"end": "2026-02-16T23:59:59.000Z"
|
|
257
|
+
},
|
|
258
|
+
"discounts": [
|
|
259
|
+
{
|
|
260
|
+
"discount": {
|
|
261
|
+
"discountType": "PERCENTAGE",
|
|
262
|
+
"percentage": 15
|
|
263
|
+
},
|
|
264
|
+
"scope": {
|
|
265
|
+
"id": "catalog",
|
|
266
|
+
"type": "CATALOG"
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
Save the returned `id` and `revision` for later management.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Step 10: Verify and remind about deactivation
|
|
279
|
+
|
|
280
|
+
1. Query discount rules to confirm the new rule exists and is `active: true`
|
|
281
|
+
2. Verify the `activeTimeInfo` window is correctly set
|
|
282
|
+
3. Report to the merchant:
|
|
283
|
+
> "{Campaign name} is live: {discount}% off {scope description} from {start_date} to {end_date}. The discount will apply automatically at checkout during this window."
|
|
284
|
+
|
|
285
|
+
4. **IMPORTANT — Deactivation reminder**: There is no native auto-deactivation in Wix discount rules. Even though `activeTimeInfo.end` is set, the rule remains in the system after expiration. Remind the merchant:
|
|
286
|
+
> "Note: After {end_date}, the discount will no longer apply at checkout, but the rule will remain active in your dashboard. You may want to deactivate or delete it after the promotion ends to keep your discount rules tidy."
|
|
287
|
+
|
|
288
|
+
---
|
|
289
|
+
|
|
290
|
+
## Branching logic
|
|
291
|
+
|
|
292
|
+
| Merchant intent | Event | Scope | Window |
|
|
293
|
+
|---|---|---|---|
|
|
294
|
+
| "Run a Black Friday sale" | Black Friday | Electronics/Fashion CATEGORY or SITE | Mon before through following Tue |
|
|
295
|
+
| "Valentine's promotion on gifts" | Valentine's Day | Gifts CATEGORY | 3-5 days before through day after |
|
|
296
|
+
| "Christmas sale on everything" | Christmas | CATALOG (site-wide) | ~5 days before through Dec 26 |
|
|
297
|
+
| "Seasonal promotion" (generic) | Next upcoming event for site's country | Determined by analytics | Standard 3-5 day lead, 1-3 day tail |
|
|
298
|
+
| "30% off for Cyber Monday" (explicit) | Cyber Monday | As specified | User-defined or standard window |
|
|
299
|
+
| No event within 30 days | None | N/A | Inform merchant; suggest general promotion instead |
|
|
300
|
+
|
|
301
|
+
## Error Handling
|
|
302
|
+
|
|
303
|
+
| Error | Cause | Fix |
|
|
304
|
+
|---|---|---|
|
|
305
|
+
| `DISCOUNT_RULE_NOT_FOUND` | Rule ID doesn't exist | Re-query discount rules for current IDs |
|
|
306
|
+
| `REVISION_MISMATCH` | Revision doesn't match | Re-fetch rule for latest revision, then retry |
|
|
307
|
+
| No upcoming event | No major holiday within 30 days of current_date | Inform merchant; suggest a general promotion or ask for a specific event |
|
|
308
|
+
| Start date in the past | Calculated start < current_date | Set start to current_date |
|
|
309
|
+
| Country not available | Site country unknown from getSiteData | Use global events (Black Friday, Christmas) as fallback |
|
|
310
|
+
| Category GUID not found | Event-relevant category doesn't exist in merchant's catalog | Fall back to SITE scope |
|
|
311
|
+
| Time conflict with existing rule | Another seasonal promotion overlaps the same window | Present conflict; suggest adjusting window or deactivating the existing rule |
|
|
312
|
+
|
|
313
|
+
## References
|
|
314
|
+
|
|
315
|
+
- [Discount Rules API](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/discounts/discount-rules/introduction)
|