@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.
Files changed (220) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/package.json +29 -0
  4. package/skills/wix-app/SKILL.md +344 -0
  5. package/skills/wix-app/references/APP_IDENTIFIERS.md +35 -0
  6. package/skills/wix-app/references/APP_MARKET_REVIEW.md +311 -0
  7. package/skills/wix-app/references/APP_VALIDATION.md +171 -0
  8. package/skills/wix-app/references/BACKEND_API.md +233 -0
  9. package/skills/wix-app/references/BACKEND_EVENT.md +116 -0
  10. package/skills/wix-app/references/CODE_QUALITY.md +33 -0
  11. package/skills/wix-app/references/CUSTOM_ELEMENT_WIDGET.md +587 -0
  12. package/skills/wix-app/references/DASHBOARD_MENU_PLUGIN.md +157 -0
  13. package/skills/wix-app/references/DASHBOARD_MODAL.md +283 -0
  14. package/skills/wix-app/references/DASHBOARD_PAGE.md +403 -0
  15. package/skills/wix-app/references/DASHBOARD_PLUGIN.md +205 -0
  16. package/skills/wix-app/references/DATA_COLLECTION.md +451 -0
  17. package/skills/wix-app/references/DOCUMENTATION.md +42 -0
  18. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +65 -0
  19. package/skills/wix-app/references/EMBEDDED_SCRIPT.md +468 -0
  20. package/skills/wix-app/references/EXTENSION_REGISTRATION.md +96 -0
  21. package/skills/wix-app/references/SERVICE_PLUGIN.md +235 -0
  22. package/skills/wix-app/references/SITE_PLUGIN.md +436 -0
  23. package/skills/wix-app/references/STORES_VERSIONING.md +334 -0
  24. package/skills/wix-app/references/backend-event/COMMON-EVENTS.md +84 -0
  25. package/skills/wix-app/references/custom-element-widget/SETTINGS_PANEL.md +345 -0
  26. package/skills/wix-app/references/dashboard-menu-plugin/blog-slots.md +71 -0
  27. package/skills/wix-app/references/dashboard-menu-plugin/bookings-slots.md +58 -0
  28. package/skills/wix-app/references/dashboard-menu-plugin/crm-slots.md +8 -0
  29. package/skills/wix-app/references/dashboard-menu-plugin/ecommerce-slots.md +17 -0
  30. package/skills/wix-app/references/dashboard-menu-plugin/events-slots.md +29 -0
  31. package/skills/wix-app/references/dashboard-menu-plugin/restaurants-slots.md +27 -0
  32. package/skills/wix-app/references/dashboard-menu-plugin/stores-slots.md +35 -0
  33. package/skills/wix-app/references/dashboard-page/API_SPEC.md +138 -0
  34. package/skills/wix-app/references/dashboard-page/DASHBOARD_API.md +573 -0
  35. package/skills/wix-app/references/dashboard-page/DYNAMIC_PARAMETERS.md +269 -0
  36. package/skills/wix-app/references/dashboard-page/ECOM_NAVIGATION.md +164 -0
  37. package/skills/wix-app/references/dashboard-plugin/SLOTS.md +294 -0
  38. package/skills/wix-app/references/data-collection/WIX_DATA.md +270 -0
  39. package/skills/wix-app/references/data-collection/extension-template.ts +107 -0
  40. package/skills/wix-app/references/editor-react-component/ACCESSIBILITY.md +138 -0
  41. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +454 -0
  42. package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +165 -0
  43. package/skills/wix-app/references/editor-react-component/CSS-GUIDELINES.md +576 -0
  44. package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +170 -0
  45. package/skills/wix-app/references/editor-react-component/EDIT-FLOW.md +6 -0
  46. package/skills/wix-app/references/editor-react-component/PARTS.md +25 -0
  47. package/skills/wix-app/references/editor-react-component/PROPS-VS-CSS.md +203 -0
  48. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +167 -0
  49. package/skills/wix-app/references/editor-react-component/REACT-PATTERNS.md +137 -0
  50. package/skills/wix-app/references/service-plugin/ADDITIONAL-FEES.md +112 -0
  51. package/skills/wix-app/references/service-plugin/BOOKINGS-STAFF-SORTING.md +118 -0
  52. package/skills/wix-app/references/service-plugin/DISCOUNT-TRIGGERS.md +87 -0
  53. package/skills/wix-app/references/service-plugin/GIFT-CARDS.md +86 -0
  54. package/skills/wix-app/references/service-plugin/PAYMENT-SETTINGS.md +135 -0
  55. package/skills/wix-app/references/service-plugin/SHIPPING-RATES.md +79 -0
  56. package/skills/wix-app/references/service-plugin/VALIDATIONS.md +68 -0
  57. package/skills/wix-app/references/site-plugin/EXAMPLES.md +311 -0
  58. package/skills/wix-app/references/site-plugin/SLOTS.md +263 -0
  59. package/skills/wix-design-system/SKILL.md +129 -0
  60. package/skills/wix-design-system/references/file-structure.md +56 -0
  61. package/skills/wix-design-system/scripts/wds.cjs +531 -0
  62. package/skills/wix-headless/SKILL.md +418 -0
  63. package/skills/wix-headless/references/DISCOVERY.md +332 -0
  64. package/skills/wix-headless/references/ORCHESTRATION.md +269 -0
  65. package/skills/wix-headless/references/SETUP.md +154 -0
  66. package/skills/wix-headless/references/blog/BLOG_CONTENT.md +152 -0
  67. package/skills/wix-headless/references/blog/BLOG_PAGES.md +299 -0
  68. package/skills/wix-headless/references/blog/BLOG_SETUP.md +218 -0
  69. package/skills/wix-headless/references/blog/INSTRUCTIONS.md +32 -0
  70. package/skills/wix-headless/references/cms/CMS_FOUNDATIONS.md +373 -0
  71. package/skills/wix-headless/references/cms/FAQ_KNOWLEDGE_BASE.md +229 -0
  72. package/skills/wix-headless/references/cms/INSTRUCTIONS.md +40 -0
  73. package/skills/wix-headless/references/cms/PORTFOLIO.md +454 -0
  74. package/skills/wix-headless/references/cms/RESOURCE_LIBRARY.md +356 -0
  75. package/skills/wix-headless/references/cms/TEAM_DIRECTORY.md +299 -0
  76. package/skills/wix-headless/references/commands/install-app.md +42 -0
  77. package/skills/wix-headless/references/commands/known-apps.json +5 -0
  78. package/skills/wix-headless/references/commands/mcp-bootstrap.md +28 -0
  79. package/skills/wix-headless/references/designer/INSTRUCTIONS.md +828 -0
  80. package/skills/wix-headless/references/ecom/CART_PAGES.md +120 -0
  81. package/skills/wix-headless/references/ecom/CART_WIRING.md +103 -0
  82. package/skills/wix-headless/references/ecom/COMPONENTS_CSS.md +132 -0
  83. package/skills/wix-headless/references/ecom/INSTRUCTIONS.md +59 -0
  84. package/skills/wix-headless/references/forms/CONTACT_FORM.md +477 -0
  85. package/skills/wix-headless/references/forms/INSTRUCTIONS.md +43 -0
  86. package/skills/wix-headless/references/gift-cards/COMPONENTS.md +119 -0
  87. package/skills/wix-headless/references/gift-cards/INSTRUCTIONS.md +51 -0
  88. package/skills/wix-headless/references/gift-cards/PAGES.md +129 -0
  89. package/skills/wix-headless/references/images/INSTRUCTIONS.md +359 -0
  90. package/skills/wix-headless/references/shared/BUILD_NOISE.md +8 -0
  91. package/skills/wix-headless/references/shared/IMAGE_GENERATION.md +185 -0
  92. package/skills/wix-headless/references/shared/IMPLEMENTER.md +155 -0
  93. package/skills/wix-headless/references/shared/MCP_PREFIX.md +105 -0
  94. package/skills/wix-headless/references/shared/PRODUCTION_SHARP_EDGES.md +97 -0
  95. package/skills/wix-headless/references/shared/RETURN_CONTRACT.md +423 -0
  96. package/skills/wix-headless/references/shared/STYLING.md +117 -0
  97. package/skills/wix-headless/references/stores/BACK_IN_STOCK.md +178 -0
  98. package/skills/wix-headless/references/stores/CATEGORY_PAGES.md +86 -0
  99. package/skills/wix-headless/references/stores/COMPONENTS_CSS.md +129 -0
  100. package/skills/wix-headless/references/stores/HOME_AND_NAV.md +227 -0
  101. package/skills/wix-headless/references/stores/INSTRUCTIONS.md +96 -0
  102. package/skills/wix-headless/references/stores/PRODUCT_CATALOG_DATA.md +249 -0
  103. package/skills/wix-headless/references/stores/PRODUCT_PAGES.md +213 -0
  104. package/skills/wix-headless/references/stores/SHARED_WIRING.md +164 -0
  105. package/skills/wix-headless/references/verticals/_schema.json +160 -0
  106. package/skills/wix-headless/references/verticals/_schema.md +185 -0
  107. package/skills/wix-headless/references/verticals/blog.md +125 -0
  108. package/skills/wix-headless/references/verticals/cms.md +121 -0
  109. package/skills/wix-headless/references/verticals/ecom.md +96 -0
  110. package/skills/wix-headless/references/verticals/forms.md +106 -0
  111. package/skills/wix-headless/references/verticals/gift-cards.md +121 -0
  112. package/skills/wix-headless/references/verticals/stores.md +167 -0
  113. package/skills/wix-headless/scripts/check-manifest.mjs +198 -0
  114. package/skills/wix-headless/scripts/copy-utility-templates.mjs +153 -0
  115. package/skills/wix-headless/scripts/emit-design-tokens.mjs +77 -0
  116. package/skills/wix-headless/scripts/finalize-run-json.mjs +141 -0
  117. package/skills/wix-headless/scripts/init-site-json.mjs +63 -0
  118. package/skills/wix-headless/scripts/patch-decorative-slots.mjs +124 -0
  119. package/skills/wix-headless/scripts/plan-entity-image-waves.mjs +190 -0
  120. package/skills/wix-headless/scripts/preview.sh +45 -0
  121. package/skills/wix-headless/scripts/release.sh +73 -0
  122. package/skills/wix-headless/scripts/scaffold.sh +53 -0
  123. package/skills/wix-headless/scripts/seed-utilities.sh +55 -0
  124. package/skills/wix-headless/shared-utilities/analytics.ts +40 -0
  125. package/skills/wix-headless/shared-utilities/ricos.ts +179 -0
  126. package/skills/wix-headless/shared-utilities/wix-image.ts +72 -0
  127. package/skills/wix-headless/templates/ecom/CartBadge.tsx +84 -0
  128. package/skills/wix-headless/templates/ecom/CartView.tsx +543 -0
  129. package/skills/wix-headless/templates/ecom/cart.astro +13 -0
  130. package/skills/wix-headless/templates/ecom/components-ecom.css +215 -0
  131. package/skills/wix-headless/templates/ecom/discounts.ts +71 -0
  132. package/skills/wix-headless/templates/ecom/thank-you.astro +24 -0
  133. package/skills/wix-headless/templates/gift-cards/GiftCardPurchase.tsx +172 -0
  134. package/skills/wix-headless/templates/gift-cards/_home-teaser-snippet.astro +42 -0
  135. package/skills/wix-headless/templates/gift-cards/_nav-snippet.astro +11 -0
  136. package/skills/wix-headless/templates/gift-cards/components-gift-cards.css +219 -0
  137. package/skills/wix-headless/templates/gift-cards/gift-cards.astro +51 -0
  138. package/skills/wix-headless/templates/gift-cards/gift-cards.ts +75 -0
  139. package/skills/wix-headless/templates/stores/AddToCartButton.tsx +77 -0
  140. package/skills/wix-headless/templates/stores/BackInStockForm.tsx +176 -0
  141. package/skills/wix-headless/templates/stores/CategoryRail.astro +69 -0
  142. package/skills/wix-headless/templates/stores/ProductCard.astro +79 -0
  143. package/skills/wix-headless/templates/stores/ProductPurchase.tsx +397 -0
  144. package/skills/wix-headless/templates/stores/SeoTags.astro +21 -0
  145. package/skills/wix-headless/templates/stores/back-in-stock.ts +67 -0
  146. package/skills/wix-headless/templates/stores/categories.ts +155 -0
  147. package/skills/wix-headless/templates/stores/category/[slug].astro +130 -0
  148. package/skills/wix-headless/templates/stores/components-stores.css +295 -0
  149. package/skills/wix-headless/templates/stores/products/[slug].astro +128 -0
  150. package/skills/wix-headless/templates/stores/products/index.astro +101 -0
  151. package/skills/wix-manage/SKILL.md +280 -0
  152. package/skills/wix-manage/references/app-installation/install-wix-apps.md +155 -0
  153. package/skills/wix-manage/references/app-installation/list-installed-apps.md +124 -0
  154. package/skills/wix-manage/references/blog/how-to-create-blog-posts.md +226 -0
  155. package/skills/wix-manage/references/bookings/booking-service-policy-setup.md +95 -0
  156. package/skills/wix-manage/references/bookings/booking-system-integration-gaps.md +416 -0
  157. package/skills/wix-manage/references/bookings/bookings-staff-setup.md +255 -0
  158. package/skills/wix-manage/references/bookings/create-and-update-booking-services.md +462 -0
  159. package/skills/wix-manage/references/bookings/end-to-end-booking-flow.md +278 -0
  160. package/skills/wix-manage/references/bookings/external-calendar-integration.md +258 -0
  161. package/skills/wix-manage/references/bookings/multi-resource-service-creation.md +231 -0
  162. package/skills/wix-manage/references/calendar/configure-default-business-hours.md +226 -0
  163. package/skills/wix-manage/references/cms/cms-data-items-crud.md +422 -0
  164. package/skills/wix-manage/references/cms/cms-data-operations-extended.md +263 -0
  165. package/skills/wix-manage/references/cms/cms-ecommerce-catalog-integration.md +136 -0
  166. package/skills/wix-manage/references/cms/cms-references-and-relationships.md +160 -0
  167. package/skills/wix-manage/references/cms/cms-schema-management.md +143 -0
  168. package/skills/wix-manage/references/contacts/bulk-delete-contacts.md +73 -0
  169. package/skills/wix-manage/references/contacts/bulk-label-and-unlabel-contacts.md +67 -0
  170. package/skills/wix-manage/references/domains/domain-search-and-purchase.md +434 -0
  171. package/skills/wix-manage/references/ecommerce/api-recommendation-tracking.md +420 -0
  172. package/skills/wix-manage/references/ecommerce/flow-add-free-shipping.md +267 -0
  173. package/skills/wix-manage/references/ecommerce/flow-bundle-and-save.md +290 -0
  174. package/skills/wix-manage/references/ecommerce/flow-fix-coverage-gaps.md +300 -0
  175. package/skills/wix-manage/references/ecommerce/flow-optimize-shipping-rates.md +364 -0
  176. package/skills/wix-manage/references/ecommerce/flow-seasonal-promotion.md +315 -0
  177. package/skills/wix-manage/references/ecommerce/flow-stock-mover.md +308 -0
  178. package/skills/wix-manage/references/ecommerce/flow-upsell-boost.md +271 -0
  179. package/skills/wix-manage/references/ecommerce/goal-clear-inventory.md +118 -0
  180. package/skills/wix-manage/references/ecommerce/goal-drive-cross-sells.md +122 -0
  181. package/skills/wix-manage/references/ecommerce/goal-increase-aov.md +132 -0
  182. package/skills/wix-manage/references/ecommerce/goal-reduce-cart-abandonment.md +148 -0
  183. package/skills/wix-manage/references/ecommerce/goal-seasonal-revenue.md +146 -0
  184. package/skills/wix-manage/references/ecommerce/guardrail-discount-conflicts.md +118 -0
  185. package/skills/wix-manage/references/ecommerce/guardrail-margin-protection.md +88 -0
  186. package/skills/wix-manage/references/ecommerce/guardrail-rate-pricing-sanity.md +108 -0
  187. package/skills/wix-manage/references/ecommerce/guardrail-shipping-health.md +124 -0
  188. package/skills/wix-manage/references/ecommerce/recipe-apply-shipping-recommendations.md +299 -0
  189. package/skills/wix-manage/references/ecommerce/recommend-ecommerce-strategy.md +582 -0
  190. package/skills/wix-manage/references/ecommerce/setup-coupons.md +338 -0
  191. package/skills/wix-manage/references/ecommerce/setup-discount-rules.md +444 -0
  192. package/skills/wix-manage/references/ecommerce/setup-shipping-rates.md +86 -0
  193. package/skills/wix-manage/references/ecommerce/setup-shipping-regions.md +56 -0
  194. package/skills/wix-manage/references/ecommerce/setup-store-pickup-location.md +209 -0
  195. package/skills/wix-manage/references/ecommerce/skill-graph.md +139 -0
  196. package/skills/wix-manage/references/ecommerce/troubleshoot-checkout-delivery-dropoff.md +124 -0
  197. package/skills/wix-manage/references/ecommerce/troubleshoot-discount-not-applying.md +95 -0
  198. package/skills/wix-manage/references/events/list-events.md +203 -0
  199. package/skills/wix-manage/references/forms/create-form.md +260 -0
  200. package/skills/wix-manage/references/get-paid/create-payment-links.md +212 -0
  201. package/skills/wix-manage/references/get-paid/how-to-setup-wix-payments.md +57 -0
  202. package/skills/wix-manage/references/get-paid/payment-links-for-bookings.md +101 -0
  203. package/skills/wix-manage/references/media/upload-media-to-wix.md +216 -0
  204. package/skills/wix-manage/references/pricing-plans/create-and-update-pricing-plans.md +77 -0
  205. package/skills/wix-manage/references/pricing-plans/pricing-plans-bookings-integration.md +166 -0
  206. package/skills/wix-manage/references/restaurants/wix-restaurants-setup.md +336 -0
  207. package/skills/wix-manage/references/rich-content/ricos-converter-service.md +295 -0
  208. package/skills/wix-manage/references/site-properties/change-payment-currency-site-properties.md +59 -0
  209. package/skills/wix-manage/references/sites/create-site-from-template.md +183 -0
  210. package/skills/wix-manage/references/sites/query-sites.md +125 -0
  211. package/skills/wix-manage/references/stores/add-store-pages-to-site.md +57 -0
  212. package/skills/wix-manage/references/stores/bulk-create-products-with-options.md +1041 -0
  213. package/skills/wix-manage/references/stores/create-product-catalog-v1.md +125 -0
  214. package/skills/wix-manage/references/stores/create-product-from-image.md +824 -0
  215. package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +566 -0
  216. package/skills/wix-manage/references/stores/find-products-query-and-search-catalog-v3.md +194 -0
  217. package/skills/wix-manage/references/stores/query-products-catalog-v1.md +80 -0
  218. package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +99 -0
  219. package/skills/wix-manage/references/stores/update-product-pre-order.md +213 -0
  220. package/skills/wix-manage/references/stores/update-product-with-options.md +318 -0
@@ -0,0 +1,444 @@
1
+ ---
2
+ name: "Setup: Discount Rules"
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), and scheduling active periods.
4
+ layer: config
5
+ ---
6
+ # Setup Discount Rules
7
+
8
+ ## Prerequisites
9
+
10
+ - Wix Stores (or another eCommerce business solution) installed on the site
11
+ - At least one product in the catalog
12
+
13
+ ## Required APIs
14
+
15
+ - [Create Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/discounts/discount-rules/create-discount-rule)
16
+ - [Get Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/discounts/discount-rules/get-discount-rule)
17
+ - [Query Discount Rules](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/discounts/discount-rules/query-discount-rules)
18
+ - [Update Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/discounts/discount-rules/update-discount-rule)
19
+ - [Delete Discount Rule](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/discounts/discount-rules/delete-discount-rule)
20
+
21
+ ---
22
+
23
+ ## Step 1: Query existing discount rules
24
+
25
+ Before creating new rules, check what already exists to avoid conflicts.
26
+
27
+ **Endpoint**: `POST https://www.wixapis.com/ecom/v1/discount-rules/query`
28
+
29
+ **Request**:
30
+ ```json
31
+ {
32
+ "query": {
33
+ "paging": {
34
+ "limit": 100
35
+ }
36
+ }
37
+ }
38
+ ```
39
+
40
+ **Response**:
41
+ ```json
42
+ {
43
+ "discountRules": [
44
+ {
45
+ "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
46
+ "revision": "1",
47
+ "name": "Summer Sale 10%",
48
+ "active": true,
49
+ "activeTimeInfo": {
50
+ "start": "2026-06-01T00:00:00.000Z",
51
+ "end": "2026-08-31T23:59:59.000Z"
52
+ },
53
+ "discounts": [
54
+ {
55
+ "discount": {
56
+ "discountType": "PERCENTAGE",
57
+ "percentage": 10
58
+ },
59
+ "scope": {
60
+ "id": "catalog",
61
+ "type": "CATALOG"
62
+ }
63
+ }
64
+ ]
65
+ }
66
+ ],
67
+ "pagingMetadata": {
68
+ "count": 1,
69
+ "hasNext": false
70
+ }
71
+ }
72
+ ```
73
+
74
+ Note existing rules and their scopes to avoid stacking conflicts.
75
+
76
+ ---
77
+
78
+ ## Step 2: Create a percentage discount rule
79
+
80
+ **Endpoint**: `POST https://www.wixapis.com/ecom/v1/discount-rules`
81
+
82
+ **Request** — 20% off all products:
83
+ ```json
84
+ {
85
+ "discountRule": {
86
+ "name": "Flash Sale 20% Off",
87
+ "active": true,
88
+ "activeTimeInfo": {
89
+ "start": "2026-05-01T00:00:00.000Z",
90
+ "end": "2026-05-03T23:59:59.000Z"
91
+ },
92
+ "discounts": [
93
+ {
94
+ "discount": {
95
+ "discountType": "PERCENTAGE",
96
+ "percentage": 20
97
+ },
98
+ "scope": {
99
+ "id": "catalog",
100
+ "type": "CATALOG"
101
+ }
102
+ }
103
+ ]
104
+ }
105
+ }
106
+ ```
107
+
108
+ **Response**:
109
+ ```json
110
+ {
111
+ "discountRule": {
112
+ "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
113
+ "revision": "1",
114
+ "name": "Flash Sale 20% Off",
115
+ "active": true,
116
+ "activeTimeInfo": {
117
+ "start": "2026-05-01T00:00:00.000Z",
118
+ "end": "2026-05-03T23:59:59.000Z"
119
+ },
120
+ "discounts": [
121
+ {
122
+ "discount": {
123
+ "discountType": "PERCENTAGE",
124
+ "percentage": 20
125
+ },
126
+ "scope": {
127
+ "id": "catalog",
128
+ "type": "CATALOG"
129
+ }
130
+ }
131
+ ]
132
+ }
133
+ }
134
+ ```
135
+
136
+ **Request** — 15% off a specific collection:
137
+ ```json
138
+ {
139
+ "discountRule": {
140
+ "name": "Summer Collection Sale",
141
+ "active": true,
142
+ "discounts": [
143
+ {
144
+ "discount": {
145
+ "discountType": "PERCENTAGE",
146
+ "percentage": 15
147
+ },
148
+ "scope": {
149
+ "id": "collection-uuid-here",
150
+ "type": "COLLECTION"
151
+ }
152
+ }
153
+ ]
154
+ }
155
+ }
156
+ ```
157
+
158
+ ---
159
+
160
+ ## Step 3: Create a fixed-amount discount rule
161
+
162
+ **Request** — $5 off specific products:
163
+ ```json
164
+ {
165
+ "discountRule": {
166
+ "name": "$5 Off Selected Items",
167
+ "active": true,
168
+ "discounts": [
169
+ {
170
+ "discount": {
171
+ "discountType": "FIXED_AMOUNT",
172
+ "fixedAmount": "5.00"
173
+ },
174
+ "scope": {
175
+ "id": "product-uuid-here",
176
+ "type": "SPECIFIC_PRODUCTS"
177
+ }
178
+ }
179
+ ]
180
+ }
181
+ }
182
+ ```
183
+
184
+ ---
185
+
186
+ ## Step 4: Update a discount rule
187
+
188
+ **Endpoint**: `PATCH https://www.wixapis.com/ecom/v1/discount-rules/{discountRuleId}`
189
+
190
+ **Request**:
191
+ ```json
192
+ {
193
+ "discountRule": {
194
+ "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
195
+ "revision": "1",
196
+ "name": "Extended Flash Sale 25% Off",
197
+ "discounts": [
198
+ {
199
+ "discount": {
200
+ "discountType": "PERCENTAGE",
201
+ "percentage": 25
202
+ },
203
+ "scope": {
204
+ "id": "catalog",
205
+ "type": "CATALOG"
206
+ }
207
+ }
208
+ ]
209
+ }
210
+ }
211
+ ```
212
+
213
+ The `revision` field is required and must match the current revision.
214
+
215
+ ---
216
+
217
+ ## Step 5: Deactivate or delete a discount rule
218
+
219
+ To deactivate without deleting:
220
+ ```json
221
+ {
222
+ "discountRule": {
223
+ "id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
224
+ "revision": "2",
225
+ "active": false
226
+ }
227
+ }
228
+ ```
229
+
230
+ To delete permanently:
231
+
232
+ **Endpoint**: `DELETE https://www.wixapis.com/ecom/v1/discount-rules/{discountRuleId}`
233
+
234
+ ---
235
+
236
+ ## Key field rules
237
+
238
+ | Field | Required | Notes |
239
+ |---|---|---|
240
+ | `name` | Yes | Internal name for the rule |
241
+ | `active` | Yes | Whether the rule is currently applied |
242
+ | `activeTimeInfo.start` | No | ISO 8601 start time. Omit for immediate activation |
243
+ | `activeTimeInfo.end` | No | ISO 8601 end time. Omit for no expiration |
244
+ | `discounts[].discount.discountType` | Yes | `PERCENTAGE` or `FIXED_AMOUNT` |
245
+ | `discounts[].discount.percentage` | If PERCENTAGE | Integer 1-100 |
246
+ | `discounts[].discount.fixedAmount` | If FIXED_AMOUNT | Decimal string (e.g., `"5.00"`) |
247
+ | `discounts[].scope.type` | Yes | `CATALOG`, `COLLECTION`, or `SPECIFIC_PRODUCTS` |
248
+ | `discounts[].scope.id` | Yes | `"catalog"` for CATALOG type, or the collection/product UUID |
249
+
250
+ ## Scope types
251
+
252
+ | Scope Type | `scope.id` value | Description |
253
+ |---|---|---|
254
+ | `CATALOG` | `"catalog"` | Applies to all products in the store |
255
+ | `COLLECTION` | Collection UUID | Applies to all products in a specific collection |
256
+ | `SPECIFIC_PRODUCTS` | Product UUID | Applies to a single product (use multiple discount entries for multiple products) |
257
+
258
+ ## Recommendation → API Mapping
259
+
260
+ When creating a discount rule from a recommendation output, use this mapping to convert the recommendation's simplified JSON into the actual Discount Rules API payload.
261
+
262
+ ### Constants
263
+
264
+ - **Store catalog app ID**: `215238eb-22a5-4c36-9e7b-e7c08025e04e` — used in all scope constructions below.
265
+ - **Initial state**: Recommendations create rules as `active: false` with `status: "PENDING"`. The merchant must approve before the rule goes live.
266
+
267
+ ### Scope mapping
268
+
269
+ The recommendation's `scope` field maps to the API's internal scope structure. The scope ID uses a prefix convention:
270
+
271
+ | Recommendation scope | API scope type | Scope ID prefix | How to build |
272
+ |---|---|---|---|
273
+ | `SITE` | `CATALOG_ITEM` | `all_` | Set `catalogItemFilter.catalogAppId` to the store catalog app ID. No item IDs. |
274
+ | `ITEMS` | `CATALOG_ITEM` | `specific_` | Set `catalogItemFilter.catalogAppId` + `catalogItemFilter.catalogItemIds` to the product UUIDs from `productIds`. |
275
+ | `CATEGORY` | `CUSTOM_FILTER` | `collections_` | Set `customFilter.appId` to the store catalog app ID + `customFilter.params.collectionIds` to the category UUIDs from `categoryIds`. |
276
+
277
+ **Example — SITE scope**:
278
+ ```json
279
+ {
280
+ "scope": {
281
+ "id": "all_215238eb-22a5-4c36-9e7b-e7c08025e04e",
282
+ "type": "CATALOG_ITEM",
283
+ "catalogItemFilter": {
284
+ "catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
285
+ }
286
+ }
287
+ }
288
+ ```
289
+
290
+ **Example — ITEMS scope** (with product IDs):
291
+ ```json
292
+ {
293
+ "scope": {
294
+ "id": "specific_215238eb-22a5-4c36-9e7b-e7c08025e04e",
295
+ "type": "CATALOG_ITEM",
296
+ "catalogItemFilter": {
297
+ "catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
298
+ "catalogItemIds": ["product-uuid-1", "product-uuid-2"]
299
+ }
300
+ }
301
+ }
302
+ ```
303
+
304
+ **Example — CATEGORY scope** (with collection IDs):
305
+ ```json
306
+ {
307
+ "scope": {
308
+ "id": "collections_215238eb-22a5-4c36-9e7b-e7c08025e04e",
309
+ "type": "CUSTOM_FILTER",
310
+ "customFilter": {
311
+ "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
312
+ "params": {
313
+ "collectionIds": ["collection-uuid-1"]
314
+ }
315
+ }
316
+ }
317
+ }
318
+ ```
319
+
320
+ ### Discount type mapping
321
+
322
+ | Recommendation `discountType` | API field to set | Value format |
323
+ |---|---|---|
324
+ | `PERCENTAGE` | `discount.percentage` | Integer (e.g., `15`) |
325
+ | `FIXED_AMOUNT` | `discount.fixedAmount` | String (e.g., `"5.00"`) |
326
+ | `FIXED_PRICE` | `discount.fixedPrice` | String (e.g., `"29.99"`) |
327
+
328
+ All discount entries use `targetType: "SPECIFIC_ITEMS"` with the scope wrapped in `specificItemsInfo.scopes[]`.
329
+
330
+ ### Trigger mapping (conditions)
331
+
332
+ Triggers determine WHEN the discount activates. They are built from the recommendation's `conditions` fields. **If no conditions exist (both minSubTotal and minItemQuantity are 0), do NOT set a trigger — the discount applies unconditionally.**
333
+
334
+ | Condition | Trigger type | How to build |
335
+ |---|---|---|
336
+ | `minItemQuantity > 0` only | `ITEM_QUANTITY_RANGE` | Set `itemQuantityRange.from` to the value. No upper bound. Include the same scope as the discount target. |
337
+ | `minSubTotal > 0` only | `SUBTOTAL_RANGE` | Set `subtotalRange.from` to the value as a string. No upper bound. Include the same scope. |
338
+ | Both conditions > 0 | `AND` | Combine both triggers in `and.triggers[]` array. |
339
+ | Neither condition | No trigger | Leave trigger field unset entirely. |
340
+
341
+ **Example — minSubTotal trigger** (upsell boost: spend $200+):
342
+ ```json
343
+ {
344
+ "trigger": {
345
+ "triggerType": "SUBTOTAL_RANGE",
346
+ "subtotalRange": {
347
+ "from": "200",
348
+ "scopes": [
349
+ {
350
+ "id": "all_215238eb-22a5-4c36-9e7b-e7c08025e04e",
351
+ "type": "CATALOG_ITEM",
352
+ "catalogItemFilter": {
353
+ "catalogAppId": "215238eb-22a5-4c36-9e7b-e7c08025e04e"
354
+ }
355
+ }
356
+ ]
357
+ }
358
+ }
359
+ }
360
+ ```
361
+
362
+ **Example — minItemQuantity trigger** (bundle: buy 3+):
363
+ ```json
364
+ {
365
+ "trigger": {
366
+ "triggerType": "ITEM_QUANTITY_RANGE",
367
+ "itemQuantityRange": {
368
+ "from": 3,
369
+ "scopes": [
370
+ {
371
+ "id": "collections_215238eb-22a5-4c36-9e7b-e7c08025e04e",
372
+ "type": "CUSTOM_FILTER",
373
+ "customFilter": {
374
+ "appId": "215238eb-22a5-4c36-9e7b-e7c08025e04e",
375
+ "params": {
376
+ "collectionIds": ["category-uuid"]
377
+ }
378
+ }
379
+ }
380
+ ]
381
+ }
382
+ }
383
+ }
384
+ ```
385
+
386
+ **Example — AND trigger** (both conditions):
387
+ ```json
388
+ {
389
+ "trigger": {
390
+ "triggerType": "AND",
391
+ "and": {
392
+ "triggers": [
393
+ {
394
+ "triggerType": "ITEM_QUANTITY_RANGE",
395
+ "itemQuantityRange": { "from": 2, "scopes": [/* same scope */] }
396
+ },
397
+ {
398
+ "triggerType": "SUBTOTAL_RANGE",
399
+ "subtotalRange": { "from": "100", "scopes": [/* same scope */] }
400
+ }
401
+ ]
402
+ }
403
+ }
404
+ }
405
+ ```
406
+
407
+ ### Date handling
408
+
409
+ | Recommendation field | API mapping |
410
+ |---|---|
411
+ | `startDate` is a date string (e.g., `"2026-06-01"`) | Convert to ISO 8601 timestamp: `activeTimeInfo.start` |
412
+ | `startDate` is empty `""` | Default to current time (now) |
413
+ | `endDate` is a date string | Convert to ISO 8601 timestamp: `activeTimeInfo.end` |
414
+ | `endDate` is empty `""` | Omit `activeTimeInfo.end` — rule has no expiration |
415
+
416
+ ### Settings
417
+
418
+ All recommendation-created rules use these fixed settings:
419
+ ```json
420
+ {
421
+ "settings": {
422
+ "appliesTo": "ALL_ITEMS",
423
+ "indexOptIn": true
424
+ }
425
+ }
426
+ ```
427
+
428
+ ---
429
+
430
+ ## Error Handling
431
+
432
+ | Error | Cause | Fix |
433
+ |---|---|---|
434
+ | `DISCOUNT_RULE_NOT_FOUND` | The discount rule ID doesn't exist | Re-query discount rules to get current IDs |
435
+ | `REVISION_MISMATCH` | The `revision` doesn't match the current version | Re-fetch the rule to get the latest revision, then retry |
436
+ | `INVALID_DISCOUNT_TYPE` | Unsupported discount type | Use `PERCENTAGE` or `FIXED_AMOUNT` |
437
+ | Both `productIds` and `categoryIds` set | Scope mutual exclusivity violation | Use only one: ITEMS with productIds OR CATEGORY with categoryIds |
438
+ | `productIds` empty when scope is ITEMS | Missing required IDs | Query products and provide at least 1 product UUID |
439
+ | `categoryIds` empty when scope is CATEGORY | Missing required IDs | Call getCategoryIds to convert category names to GUIDs |
440
+
441
+ ## References
442
+
443
+ - [Discount Rules API](https://dev.wix.com/docs/api-reference/business-solutions/e-commerce/extensions/discounts/discount-rules/introduction)
444
+ - [Coupons API](https://dev.wix.com/docs/api-reference/business-solutions/coupons/introduction)
@@ -0,0 +1,86 @@
1
+ ---
2
+ name: "Setup: Shipping Rates"
3
+ description: Configures shipping option rates — rate types (flat, tiered, free), condition types and operators, free shipping threshold calibration, AOV sanity check, per-item penalty avoidance, and tier gap detection.
4
+ layer: config
5
+ ---
6
+ # Shipping Rates
7
+
8
+ ## AOV Sanity Check
9
+
10
+ **MANDATORY before any threshold calculation that references AOV.** Raw AOV can be misleading due to data issues or bulk purchases.
11
+
12
+ 1. Extract `price_p25` and `price_p50` from `catalog_stats` (use the "All Products" category group).
13
+
14
+ 2. Evaluate AOV against catalog price distribution:
15
+
16
+ | Condition | Interpretation | Action |
17
+ |---|---|---|
18
+ | AOV < price_p25 | Anomalous — likely a data or unit issue | Override: use `price_p50` as base. Note in reasoning. |
19
+ | AOV > price_p90 | Possible bulk/combo orders | Still use AOV but note discrepancy. |
20
+ | price_p25 <= AOV <= price_p90 | Reasonable | Use AOV as-is. |
21
+
22
+ 3. Store the result as `effective_aov`. Use `effective_aov` everywhere AOV would be referenced — backup rate calibration, shipping thresholds, free shipping thresholds.
23
+
24
+ ---
25
+
26
+ ## Rate Types
27
+
28
+ Rate types are determined by the conditions array, not by an explicit field.
29
+
30
+ | Rate Type | Configuration |
31
+ |---|---|
32
+ | Flat rate | `conditions[]` empty, just `amount` |
33
+ | Free shipping | `amount = "0"` with optional `BY_TOTAL_PRICE GTE [threshold]` |
34
+ | Weight-based tiers | `BY_TOTAL_WEIGHT` conditions |
35
+ | Price-based tiers | `BY_TOTAL_PRICE` conditions |
36
+ | Quantity-based | `BY_TOTAL_QUANTITY` conditions |
37
+
38
+ ## Condition Operators
39
+
40
+ Supported operators: `EQ`, `GT`, `GTE`, `LT`, `LTE`.
41
+
42
+ When multiple conditions appear in the same rate entry, they combine with AND logic.
43
+
44
+ ## Free Shipping Threshold Calibration
45
+
46
+ Optimal range: `effective_aov x 1.0` to `effective_aov x 1.5`
47
+
48
+ | Scenario | Impact |
49
+ |---|---|
50
+ | `threshold > AOV x 2` | Too high -- customers rarely qualify |
51
+ | `threshold < AOV x 0.8` | Too low -- potential margin erosion |
52
+
53
+ Enhanced calibration using catalog stats:
54
+ - If `price_p75 > aov x 1.5` then use `price_p50 x 1.5`
55
+ - If `price_p75 < aov` then use `aov x 1.2`
56
+ - Default: `max(aov x 1.2, price_p75)`
57
+
58
+ ## Per-Item Penalty Avoidance
59
+
60
+ `multiplyByQuantity = true` charges `amount x cart quantity`. Always flag this configuration and recommend switching to flat rate or tiered pricing instead.
61
+
62
+ ## Price-Based Tiers Recommendation
63
+
64
+ Recommend switching from flat to tiered rates when ALL of the following are true:
65
+ - `price_spread_ratio > 10`
66
+ - `price_stddev > price_avg x 0.5`
67
+ - Only flat rates currently exist
68
+
69
+ Recommended tier structure:
70
+ - **Tier 1**: Below p50 -- lower rate
71
+ - **Tier 2**: p50 to p75 -- standard rate
72
+ - **Tier 3**: Above p75 -- higher rate or free
73
+
74
+ ## Flat Rate Confirmation
75
+
76
+ When ALL of the following are true, flat rate is optimal and no change is needed:
77
+ - `price_spread_ratio <= 3`
78
+ - `price_stddev < price_avg x 0.3`
79
+
80
+ ## Tier Gap Detection
81
+
82
+ Sort all conditions by value and look for gaps between ranges. Gaps mean some cart totals have no matching rate, which can cause checkout failures.
83
+
84
+ ## Shipping Cost Sanity Check
85
+
86
+ Any rate `amount > AOV x 0.15` (15% of average order value) should be flagged as a cart abandonment risk.
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: "Setup: Shipping Regions"
3
+ description: Configures delivery profiles and regions — creating profiles, adding regions with destinations, assigning carriers, enabling backup rates, and handling externally managed regions.
4
+ layer: config
5
+ ---
6
+ # Shipping Regions
7
+
8
+ ## Creating Delivery Profiles
9
+
10
+ - The first profile is auto-created when Stores is installed.
11
+ - Up to **99 profiles** per site.
12
+
13
+ ## Adding Regions
14
+
15
+ - Up to **100 regions** per profile.
16
+ - Each region requires: `name`, `destinations` (array of country codes), `active` flag.
17
+
18
+ ### Domestic Region
19
+
20
+ Set `countryCode` to match `site_context.country`.
21
+
22
+ ### International Region
23
+
24
+ Use multiple country codes, or leave `destinations` empty to represent "Rest of World."
25
+
26
+ ## Assigning Carriers
27
+
28
+ - Up to **25 carriers** per region.
29
+ - Use `appId` to identify the carrier.
30
+
31
+ ## Enabling Backup Rates
32
+
33
+ CRITICAL -- set `backupRate.active = true` on each carrier. The backup rate amount should be **5-10% of effective AOV**.
34
+
35
+ Without a backup rate, if the carrier service fails the shipping option silently disappears from checkout.
36
+
37
+ ## External Carrier Detection
38
+
39
+ - Shippo `appId`: `2b1943e2-3fc2-47bc-be56-3d402e5966d7`
40
+ - If **ALL** carriers in a region are external, skip that region -- it is externally managed.
41
+ - If the region has a mix of external and Wix-native carriers, treat it as hybrid and only configure the Wix-native carriers.
42
+
43
+ ## Business Context Filter for International (MANDATORY)
44
+
45
+ Check the site's industry. If it matches any of the following categories, DO NOT recommend international shipping:
46
+
47
+ food, restaurant, grocery, bakery, catering, perishable, fresh, meat, produce, dairy, drink, beverage
48
+
49
+ Perishable goods require cold chain logistics that standard international shipping does not support.
50
+
51
+ ## Identifying International Regions
52
+
53
+ A region is considered "international" if any of the following are true:
54
+ - Region name contains "international" or "internacional" (case-insensitive)
55
+ - `destinations[]` is empty (Rest of World)
56
+ - `destinations` include countries OTHER than the site country