@wix/agent-skills 1.16.0 → 1.16.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/package.json +1 -1
  2. package/skills/wix-app/SKILL.md +72 -8
  3. package/skills/wix-app/references/CODE_QUALITY.md +0 -1
  4. package/skills/wix-app/references/DASHBOARD_MODAL.md +21 -14
  5. package/skills/wix-app/references/DASHBOARD_PAGE.md +30 -184
  6. package/skills/wix-app/references/EDITOR_REACT_COMPONENT.md +19 -3
  7. package/skills/wix-app/references/WIX_PATTERNS_DOCS.md +172 -0
  8. package/skills/wix-app/references/dashboard-page/WDS_LAYOUT.md +187 -0
  9. package/skills/wix-app/references/editor-react-component/A11Y-REVIEW.md +12 -7
  10. package/skills/wix-app/references/editor-react-component/ANIMATED-COMPONENTS.md +31 -2
  11. package/skills/wix-app/references/editor-react-component/COMPONENT-API.md +6 -1
  12. package/skills/wix-app/references/editor-react-component/COMPONENT-CONFIGURATION.md +60 -0
  13. package/skills/wix-app/references/editor-react-component/DIRECTIONALITY.md +6 -6
  14. package/skills/wix-app/references/editor-react-component/FUNCTION-HANDLERS.md +167 -0
  15. package/skills/wix-app/references/editor-react-component/REACT-GUIDELINES.md +2 -2
  16. package/skills/wix-app/references/editor-react-component/SITE-CONTEXT-HOOKS.md +187 -0
  17. package/skills/wix-app/scripts/scan-a11y-code.cjs +777 -0
  18. package/skills/wix-app/scripts/scan-a11y-eslint.cjs +201 -0
  19. package/skills/wix-base44-connector/SKILL.md +185 -0
  20. package/skills/wix-base44-connector/scripts/utils.js +212 -0
  21. package/skills/wix-design-system/SKILL.md +19 -15
  22. package/skills/wix-docs/SKILL.md +75 -1
  23. package/skills/wix-headless/references/CAPABILITIES.md +16 -3
  24. package/skills/wix-headless/references/SDK_HANDOFF.md +1 -1
  25. package/skills/wix-headless/references/SEED.md +1 -1
  26. package/skills/wix-headless/references/inline-recipes/how-to-code-forms.md +560 -102
  27. package/skills/wix-headless/references/inline-recipes/setup-forms.md +210 -143
  28. package/skills/wix-manage/SKILL.md +20 -17
  29. package/skills/wix-manage/references/accessibility/scan-site-accessibility.md +98 -0
  30. package/skills/wix-manage/references/analytics/analytics-dashboard-navigation.md +1 -2
  31. package/skills/wix-manage/references/domains/domain-search-purchase-and-connect.md +2603 -0
  32. package/skills/wix-manage/references/events/create-wix-event.md +112 -90
  33. package/skills/wix-manage/references/events/manage-wix-events.md +33 -94
  34. package/skills/wix-manage/references/sites/create-headless-site.md +1 -0
  35. package/skills/wix-manage/references/sites/manage-oauth-apps.md +154 -0
  36. package/skills/wix-manage/references/sites/read-site-context.md +125 -0
  37. package/skills/wix-manage/references/sites/site-import.md +67 -15
  38. package/skills/wix-manage/references/stores/create-product-catalog-v3.md +273 -0
  39. package/skills/wix-replatform/resources/rp-target-wix/lib/wix-writers.js +1 -1
  40. package/skills/wix-vibe-headless/SKILL.md +2 -1
  41. package/skills/wix-vibe-headless/install/deploy.cjs +63 -3
  42. package/skills/wix-vibe-headless/platforms/base44-ecom-light-seed.md +104 -0
  43. package/skills/wix-vibe-headless/platforms/base44-ecom-light.md +74 -0
  44. package/skills/wix-vibe-headless/platforms/base44.md +15 -40
  45. package/skills/wix-vibe-headless/references/blog/INSTRUCTIONS.md +7 -11
  46. package/skills/wix-vibe-headless/references/blog/seed/SEED.md +1 -1
  47. package/skills/wix-vibe-headless/references/bookings/INSTRUCTIONS.md +7 -11
  48. package/skills/wix-vibe-headless/references/bookings/seed/SEED.md +1 -1
  49. package/skills/wix-vibe-headless/references/cms/INSTRUCTIONS.md +1 -2
  50. package/skills/wix-vibe-headless/references/events/INSTRUCTIONS.md +7 -12
  51. package/skills/wix-vibe-headless/references/events/seed/SEED.md +1 -1
  52. package/skills/wix-vibe-headless/references/members/INSTRUCTIONS.md +7 -11
  53. package/skills/wix-vibe-headless/references/portfolio/INSTRUCTIONS.md +7 -11
  54. package/skills/wix-vibe-headless/references/portfolio/seed/SEED.md +1 -1
  55. package/skills/wix-vibe-headless/references/pricing-plans/INSTRUCTIONS.md +7 -11
  56. package/skills/wix-vibe-headless/references/pricing-plans/seed/SEED.md +1 -1
  57. package/skills/wix-vibe-headless/references/restaurants/INSTRUCTIONS.md +7 -11
  58. package/skills/wix-vibe-headless/references/restaurants/seed/SEED.md +1 -1
  59. package/skills/wix-vibe-headless/references/shared/app/components/WixManageBanner.jsx +1 -1
  60. package/skills/wix-vibe-headless/references/shared/app/rest/wix-config.js +5 -3
  61. package/skills/wix-vibe-headless/references/storefront/INSTRUCTIONS.md +75 -13
  62. package/skills/wix-vibe-headless/references/storefront/app/components/ProductCard.jsx +29 -86
  63. package/skills/wix-vibe-headless/references/storefront/app/components/ProductGrid.jsx +3 -8
  64. package/skills/wix-vibe-headless/references/storefront/app/components/VariantPicker.jsx +78 -105
  65. package/skills/wix-vibe-headless/references/storefront/app/hooks/useProductCard.js +92 -0
  66. package/skills/wix-vibe-headless/references/storefront/app/hooks/useVariantOptions.js +76 -0
  67. package/skills/wix-vibe-headless/references/storefront/seed/SEED.md +1 -1
  68. package/skills/wix-vibe-headless/references/storefront/seed/seed-store.js +44 -5
  69. package/skills/wix-app/references/AUTO_PATTERNS_DASHBOARD.md +0 -326
  70. package/skills/wix-app/references/auto-patterns-dashboard/action-cell.md +0 -115
  71. package/skills/wix-app/references/auto-patterns-dashboard/app-config-structure.md +0 -264
  72. package/skills/wix-app/references/auto-patterns-dashboard/app-context.md +0 -37
  73. package/skills/wix-app/references/auto-patterns-dashboard/bulk-actions.md +0 -86
  74. package/skills/wix-app/references/auto-patterns-dashboard/collection-page-actions.md +0 -119
  75. package/skills/wix-app/references/auto-patterns-dashboard/collection-page.md +0 -103
  76. package/skills/wix-app/references/auto-patterns-dashboard/custom-actions-override.md +0 -76
  77. package/skills/wix-app/references/auto-patterns-dashboard/custom-columns-override.md +0 -82
  78. package/skills/wix-app/references/auto-patterns-dashboard/custom-components-override.md +0 -89
  79. package/skills/wix-app/references/auto-patterns-dashboard/custom-header-override.md +0 -124
  80. package/skills/wix-app/references/auto-patterns-dashboard/custom-sections-override.md +0 -91
  81. package/skills/wix-app/references/auto-patterns-dashboard/custom-slots-override.md +0 -71
  82. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-actions.md +0 -70
  83. package/skills/wix-app/references/auto-patterns-dashboard/entity-page-view-actions.md +0 -73
  84. package/skills/wix-app/references/auto-patterns-dashboard/entity-page.md +0 -98
  85. package/skills/wix-app/references/auto-patterns-dashboard/example-patterns.json +0 -278
  86. package/skills/wix-app/references/auto-patterns-dashboard/pages-configuration.md +0 -94
  87. package/skills/wix-app/references/auto-patterns-dashboard/resolved-action.md +0 -43
  88. package/skills/wix-app/references/auto-patterns-dashboard/sdk-utilities.md +0 -66
  89. package/skills/wix-app/references/auto-patterns-dashboard/views.md +0 -76
  90. package/skills/wix-app/scripts/generate-auto-patterns.js +0 -510
  91. package/skills/wix-manage/references/domains/domain-search-and-purchase.md +0 -437
  92. package/skills/wix-manage/references/stores/create-product-from-image.md +0 -1031
  93. package/skills/wix-manage/references/stores/create-product-with-options-catalog-v3.md +0 -623
  94. package/skills/wix-manage/references/stores/setup-online-store-catalog-v3.md +0 -106
@@ -1,623 +0,0 @@
1
- ---
2
- name: "Create Product with Options (Catalog V3)"
3
- description: Single product creation with options using Catalog V3 Products API. Covers option types (TEXT_CHOICES, SWATCH_CHOICES), choice configuration, and automatic variant generation.
4
- ---
5
- # RECIPE: Business Recipe - Creating a Wix Store Product with options (Catalog V3)
6
-
7
- Learn how to create a Wix store product with customizable options like colors, sizes, or other variants, allowing customers to select their preferences when purchasing.
8
-
9
- ---
10
-
11
- ## Article: Steps for creating a Wix Store Product with Options
12
-
13
- ## STEP 0: Conversation — gather what's needed for a "ready-to-sell" product
14
-
15
- The goal of this step is not just to create *a* product, but to help the user create a **complete, ready-to-sell** product. Before jumping to the API call in STEP 1, run a short conversation to fill the important gaps — but keep it brief.
16
-
17
- > **CRITICAL — ASK AT MOST 1–2 FOLLOW-UP QUESTIONS.** Never interrogate the user. Ask no more than one or two follow-up questions total before creating the product. If the user is disengaged or says "just create it", proceed with sensible generated values rather than asking again.
18
-
19
- ### 0a. Opening the conversation
20
-
21
- **As soon as this skill is triggered — and the user hasn't already described a product — YOU open the conversation.** Proactively send a single opening message that invites *either or both* input paths and makes clear you'll generate the full product info from whatever they provide:
22
-
23
- > **What would you like to sell? Just describe your product in a few words and/or upload a photo of it — I'll generate the full product info (name, description, price, and any options) for you from there.**
24
-
25
- The user can reply with a text prompt, an image, or both:
26
-
27
- - **An image is provided (with or without text)** → follow the **[Create Product from Image](https://dev.wix.com/docs/api-reference/business-solutions/stores/skills/create-product-from-image)** recipe to generate the product info from the image(s), then continue from the gap check in 0b for anything still missing.
28
- - **Text only** → continue with the gap check in 0b.
29
-
30
- If the user *already* described a product when triggering the skill, skip this opening message and go straight to 0b.
31
-
32
- > **This opening message is the entry point, not a follow-up — it does NOT count against the 1–2 follow-up-question budget in 0b.**
33
-
34
- ### 0b. Gap check — decide what (if anything) to ask
35
-
36
- **Mandatory inputs are `name` and `price`.** Check what the user has already provided:
37
-
38
- **Case 1 — a mandatory input is missing (no name and/or no price):**
39
- Ask for the missing mandatory field(s), and in the same message offer to generate it for them. Combine both missing fields into a single question. For example:
40
-
41
- > "What would you like to call this product, and what price should I set? I can also suggest a name and price for you if you'd like."
42
-
43
- If the user asks you to generate them (or doesn't provide them after being asked once), generate a sensible name and price based on the product context and proceed — do not ask a second time.
44
-
45
- **Case 2 — both mandatory inputs are provided:**
46
- You may ask **one** enrichment question to make the product more complete. Ask about whichever is most relevant, and offer to do the work for them. For example:
47
-
48
- > "Does this product come in different **sizes or colors** (e.g. options customers choose from)? And would you like me to generate a **SEO description** and/or **info sections** to make it ready to sell?"
49
-
50
- - If the user wants options/choices → collect them and build the options + variants per STEP 1.
51
- - If the user wants generated SEO description and/or info sections → generate them and include them in the product.
52
- - If the user declines or says "just create it" → proceed with what you have.
53
-
54
- > **Do NOT ask about options AND enrichment as two separate rounds.** Bundle them into the single enrichment question above so the total stays within the 1–2 question budget.
55
-
56
- ### 0c. Stay focused on the product until it's saved
57
-
58
- > **CRITICAL — ONCE A PRODUCT-CREATION CONVERSATION HAS STARTED, STAY ON IT.** Do not switch to other topics, suggest unrelated tasks, or start new workflows until the product has actually been created (saved) via STEP 1 — **unless the user explicitly asks to do something else**. If the user goes off-topic, briefly answer if needed, then steer back to finishing and saving the product.
59
-
60
- ### 0d. Confirm once — then create
61
-
62
- > **CRITICAL — VALIDATE EXACTLY ONCE BEFORE CREATING.** Right before calling the Create Product API (STEP 1), show a brief summary of what you're about to create and ask for a single go-ahead. Ask **only once**. Do NOT approve-and-then-ask-again (e.g. present a summary, get a "yes", and then ask "shall I create it now?" a second time) — that double confirmation is exactly what we want to avoid. Once the user approves, go straight to STEP 1 with no further approval prompts.
63
-
64
- For example:
65
-
66
- > "Here's what I'll add to your store: **[name]** — **[price]**[, options: …]. Ready to create it?"
67
-
68
- If the user already signaled approval (e.g. "just create it", "go ahead"), treat that as the single confirmation and proceed straight to STEP 1 — do not ask again.
69
-
70
- ## STEP 1: create the product with options and variants
71
-
72
- 1. create the product with options and create variants for them - Wix REST API: [Create Product](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/products-v3/create-product) **CRITICAL: USE THIS WORKING EXAMPLE**
73
-
74
- ```bash
75
- curl -X POST 'https://www.wixapis.com/stores/v3/products' \
76
- -H 'Content-Type: application/json' \
77
- -H 'Authorization: <AUTH>' \
78
- -d '{
79
- "product": {
80
- "name": "Air Max Runner",
81
- "description": {
82
- "nodes": [
83
- {
84
- "type": "PARAGRAPH",
85
- "id": "desc1",
86
- "nodes": [
87
- {
88
- "type": "TEXT",
89
- "textData": {
90
- "text": "Premium running sneaker with advanced cushioning technology and breathable mesh design for ultimate comfort."
91
- }
92
- }
93
- ],
94
- "paragraphData": {
95
- "textStyle": {
96
- "textAlignment": "AUTO"
97
- }
98
- }
99
- }
100
- ],
101
- "metadata": {
102
- "version": 1,
103
- "id": "sneaker-desc-001"
104
- }
105
- },
106
- "productType": "PHYSICAL",
107
- "physicalProperties": {},
108
- "media": {
109
- "main": {
110
- "url": "https://images.unsplash.com/photo-1549298916-b41d501d3772?w=400&h=400&fit=crop&crop=center",
111
- "altText": "Air Max Runner - Main Product Image"
112
- },
113
- "itemsInfo": {
114
- "items": [
115
- {
116
- "url": "https://images.unsplash.com/photo-1549298916-b41d501d3772?w=400&h=400&fit=crop&crop=center",
117
- "altText": "Air Max Runner - Product View"
118
- }
119
- ]
120
- }
121
- },
122
- "options": [
123
- {
124
- "name": "Size",
125
- "optionRenderType": "TEXT_CHOICES",
126
- "choicesSettings": {
127
- "choices": [
128
- {
129
- "choiceType": "CHOICE_TEXT",
130
- "name": "8"
131
- },
132
- {
133
- "choiceType": "CHOICE_TEXT",
134
- "name": "9"
135
- },
136
- {
137
- "choiceType": "CHOICE_TEXT",
138
- "name": "10"
139
- }
140
- ]
141
- }
142
- },
143
- {
144
- "name": "Color",
145
- "optionRenderType": "TEXT_CHOICES",
146
- "choicesSettings": {
147
- "choices": [
148
- {
149
- "choiceType": "CHOICE_TEXT",
150
- "name": "Black"
151
- },
152
- {
153
- "choiceType": "CHOICE_TEXT",
154
- "name": "White"
155
- }
156
- ]
157
- }
158
- }
159
- ],
160
- "variantsInfo": {
161
- "variants": [
162
- {
163
- "choices": [
164
- {
165
- "optionChoiceNames": {
166
- "optionName": "Size",
167
- "choiceName": "8",
168
- "renderType": "TEXT_CHOICES"
169
- }
170
- },
171
- {
172
- "optionChoiceNames": {
173
- "optionName": "Color",
174
- "choiceName": "Black",
175
- "renderType": "TEXT_CHOICES"
176
- }
177
- }
178
- ],
179
- "price": {
180
- "actualPrice": {
181
- "amount": "129.99"
182
- }
183
- },
184
- "physicalProperties": {},
185
- "visible": true
186
- },
187
- {
188
- "choices": [
189
- {
190
- "optionChoiceNames": {
191
- "optionName": "Size",
192
- "choiceName": "8",
193
- "renderType": "TEXT_CHOICES"
194
- }
195
- },
196
- {
197
- "optionChoiceNames": {
198
- "optionName": "Color",
199
- "choiceName": "White",
200
- "renderType": "TEXT_CHOICES"
201
- }
202
- }
203
- ],
204
- "price": {
205
- "actualPrice": {
206
- "amount": "129.99"
207
- }
208
- },
209
- "physicalProperties": {},
210
- "visible": false
211
- },
212
- {
213
- "choices": [
214
- {
215
- "optionChoiceNames": {
216
- "optionName": "Size",
217
- "choiceName": "9",
218
- "renderType": "TEXT_CHOICES"
219
- }
220
- },
221
- {
222
- "optionChoiceNames": {
223
- "optionName": "Color",
224
- "choiceName": "Black",
225
- "renderType": "TEXT_CHOICES"
226
- }
227
- }
228
- ],
229
- "price": {
230
- "actualPrice": {
231
- "amount": "129.99"
232
- }
233
- },
234
- "physicalProperties": {},
235
- "visible": false
236
- },
237
- {
238
- "choices": [
239
- {
240
- "optionChoiceNames": {
241
- "optionName": "Size",
242
- "choiceName": "9",
243
- "renderType": "TEXT_CHOICES"
244
- }
245
- },
246
- {
247
- "optionChoiceNames": {
248
- "optionName": "Color",
249
- "choiceName": "White",
250
- "renderType": "TEXT_CHOICES"
251
- }
252
- }
253
- ],
254
- "price": {
255
- "actualPrice": {
256
- "amount": "129.99"
257
- }
258
- },
259
- "physicalProperties": {},
260
- "visible": true
261
- },
262
- {
263
- "choices": [
264
- {
265
- "optionChoiceNames": {
266
- "optionName": "Size",
267
- "choiceName": "10",
268
- "renderType": "TEXT_CHOICES"
269
- }
270
- },
271
- {
272
- "optionChoiceNames": {
273
- "optionName": "Color",
274
- "choiceName": "Black",
275
- "renderType": "TEXT_CHOICES"
276
- }
277
- }
278
- ],
279
- "price": {
280
- "actualPrice": {
281
- "amount": "129.99"
282
- }
283
- },
284
- "physicalProperties": {},
285
- "visible": true
286
- },
287
- {
288
- "choices": [
289
- {
290
- "optionChoiceNames": {
291
- "optionName": "Size",
292
- "choiceName": "10",
293
- "renderType": "TEXT_CHOICES"
294
- }
295
- },
296
- {
297
- "optionChoiceNames": {
298
- "optionName": "Color",
299
- "choiceName": "White",
300
- "renderType": "TEXT_CHOICES"
301
- }
302
- }
303
- ],
304
- "price": {
305
- "actualPrice": {
306
- "amount": "129.99"
307
- }
308
- },
309
- "physicalProperties": {},
310
- "visible": false
311
- }
312
- ]
313
- }
314
- }
315
- }'
316
- ```
317
-
318
- ### IMPORTANT NOTES:
319
-
320
- When Creating a product YOU MUST leave the physicalProperties and all other non required fields empty. for example: "physicalProperties": {}. In most cases the product will be a physical product, and therefore MUST have the empty physicalProperties object ("physicalProperties": {}) and a corresponding "productType": "PHYSICAL".
321
-
322
- **CRITICAL: variantsInfo is Always Required**
323
- `variantsInfo.variants` must contain at least one variant, even for simple products without options. Omitting it causes: `"variantsInfo must not be empty"`.
324
-
325
- **CRITICAL: Description Format**If you include a description, it MUST use Wix's rich text nodes structure, NOT a plain string. Plain strings will cause "Expected an object" API errors.
326
-
327
- **WRONG:** `"description": "Your text here"` **CORRECT:**
328
-
329
- ```json
330
- "description": {
331
- "nodes": [
332
- {
333
- "type": "PARAGRAPH",
334
- "id": "desc1",
335
- "nodes": [
336
- {
337
- "type": "TEXT",
338
- "textData": {
339
- "text": "Your product description here"
340
- }
341
- }
342
- ],
343
- "paragraphData": {
344
- "textStyle": {
345
- "textAlignment": "AUTO"
346
- }
347
- }
348
- }
349
- ],
350
- "metadata": {
351
- "version": 1,
352
- "id": "unique-desc-id"
353
- }
354
- }
355
- ```
356
-
357
- **CRITICAL: Media Format**
358
- To add product images, use the `media` object with `main` for the primary image and `itemsInfo.items` for additional gallery images. **YOU MUST** add an image to each product.
359
-
360
- > **Important:** The V3 Products API requires **URLs** for media, not media IDs. Even when using files from the Media Manager, you must use the full wixstatic.com URL.
361
-
362
- **Option 1: Using External URLs Directly**
363
-
364
- You can reference images directly from external URLs that allow hotlinking (e.g., Unsplash, Pexels):
365
-
366
- ```json
367
- "media": {
368
- "main": {
369
- "url": "https://images.unsplash.com/photo-1549298916-b41d501d3772?w=400",
370
- "altText": "Product Main Image"
371
- },
372
- "itemsInfo": {
373
- "items": [
374
- {
375
- "url": "https://images.unsplash.com/photo-1549298916-b41d501d3772?w=400",
376
- "altText": "Product View"
377
- }
378
- ]
379
- }
380
- }
381
- ```
382
-
383
- > **Warning:** Some external URLs may fail if the source server blocks requests or has hotlink protection. For reliable media, use Option 2.
384
-
385
- **Option 2: Using Media Manager (Recommended)**
386
-
387
- For reliable, permanent media storage, first upload the image to the site's Media Manager, then use the returned wixstatic.com URL.
388
-
389
- **Step 1:** Upload the image to Media Manager using the Import File API:
390
-
391
- ```bash
392
- curl -X POST 'https://www.wixapis.com/site-media/v1/files/import' \
393
- -H 'Content-Type: application/json' \
394
- -H 'Authorization: <AUTH>' \
395
- -d '{
396
- "url": "https://images.unsplash.com/photo-1563729784474-d77dbb933a9e?w=400",
397
- "mimeType": "image/jpeg",
398
- "displayName": "Product Image"
399
- }'
400
- ```
401
-
402
- Response includes the wixstatic.com URL:
403
-
404
- ```json
405
- {
406
- "file": {
407
- "id": "e6a89e_19dae9fef9bb48a6b5e392d0d2e5b95d~mv2.jpg",
408
- "url": "https://static.wixstatic.com/media/e6a89e_19dae9fef9bb48a6b5e392d0d2e5b95d~mv2.jpg",
409
- "operationStatus": "PENDING"
410
- }
411
- }
412
- ```
413
-
414
- > **Note:** Wait for `operationStatus` to become `READY` before using the media. You can verify by calling the List Files API (`GET /site-media/v1/files`).
415
-
416
- **Step 2:** Use the wixstatic.com **URL** (not the ID) when creating the product:
417
-
418
- ```json
419
- "media": {
420
- "main": {
421
- "url": "https://static.wixstatic.com/media/e6a89e_19dae9fef9bb48a6b5e392d0d2e5b95d~mv2.jpg",
422
- "altText": "Product Image"
423
- },
424
- "itemsInfo": {
425
- "items": [
426
- {
427
- "url": "https://static.wixstatic.com/media/e6a89e_19dae9fef9bb48a6b5e392d0d2e5b95d~mv2.jpg",
428
- "altText": "Product Image"
429
- }
430
- ]
431
- }
432
- }
433
- ```
434
-
435
- > **Why use Media Manager?** External URLs can fail if the source server blocks requests. Once uploaded to Media Manager, the file is permanently stored on Wix servers and the wixstatic.com URL is always reliable.
436
-
437
- **CRITICAL: Options Structure**Each option MUST include:
438
-
439
- * `optionRenderType`: "TEXT_CHOICES" for text-based choices
440
- * `choicesSettings`: Object containing the choices array
441
- * `choicesSettings.choices`: Array with at least one choice
442
- * Each choice MUST have `choiceType`: "CHOICE_TEXT" and `name` properties
443
-
444
- **CRITICAL: Variants Structure**
445
-
446
- * Create one variant for EVERY combination of option choices (Cartesian product of all options)
447
- * In this example: 2 colors and 3 sizes creates 6 variants (2 x 3) - all combinations must be included
448
- * Each variant must reference ALL options defined on the product
449
- * Use `optionChoiceNames` structure with `optionName`, `choiceName`, and `renderType`
450
- * Price must use `price.actualPrice.amount` with string values
451
- * Use `visible: true` for variants you want customers to see and purchase
452
- * Use `visible: false` for variants that exist but should be hidden from customers
453
-
454
- The Create Product API can handle creating customizations and choices in a single call. There's no need to separately check for existing customizations, create new ones, or add choices to them—the API handles all of this automatically:
455
-
456
- 1. If you provide an option with a name that doesn't exist as a customization, a new customization will be created
457
- 2. If a customization with that name already exists, it will be associated with the product
458
- 3. New choices will be added to the customization if they don't exist
459
- 4. When creating variants, use optionChoiceNames rather than optionChoiceIds to reference the options and choices
460
- 5. Always include the choicesSettings object with the complete list of choices
461
- 6. You must create one variant for each combination of option choices
462
-
463
- ### Next Steps:
464
-
465
- After Creating the product, verify that the options appear correctly in the store and that customers can select different variants.
466
-
467
- > **Need to Update This Product Later?**
468
- >
469
- > See [Update Product with Options](update-product-with-options.md) for updating existing products.
470
- >
471
- > **Important:** All update operations (PATCH) require the current `product.revision` value. Always GET the product first to obtain the revision before updating.
472
-
473
- ## Troubleshooting Common Issues
474
-
475
- ### Issue 1: "ChoicesSettings must not be empty" error
476
-
477
- * **Problem**: When creating a product with options, you get an error saying `choicesSettings must not be empty`. This can appear in several forms:
478
- * `"product is invalid: options [at index 0] is invalid: value choicesSettings must not be empty"`
479
- * `"product is invalid: options [at index 0] is invalid: value choicesSettings must not be empty"` with `"violatedRule":"REQUIRED_ONE_OF_FIELD"`
480
- * `"choicesSettings must not be empty"` with field violations showing `"supported":["choicesSettings"]`
481
- * **Solution**: Always include the `choicesSettings` object with the full array of `choices` when creating a product with options. Every option MUST have a complete choicesSettings structure with at least one choice, even when using an existing customization.
482
-
483
- **Common Causes:**
484
-
485
- 1. **Missing choicesSettings entirely** - The option object doesn't include any choicesSettings
486
- 2. **Empty choicesSettings object** - The choicesSettings exists but has no choices array or empty choices array
487
- 3. **Null or undefined choicesSettings** - The choicesSettings field is present but set to null/undefined
488
-
489
- **Example of correct choicesSettings structure:**
490
-
491
- ```json
492
- "options": [
493
- {
494
- "name": "Size",
495
- "optionRenderType": "TEXT_CHOICES",
496
- "choicesSettings": {
497
- "choices": [
498
- {
499
- "choiceType": "CHOICE_TEXT",
500
- "name": "Small"
501
- }
502
- ]
503
- }
504
- }
505
- ]
506
- ```
507
-
508
- **What NOT to do:**
509
-
510
- ```json
511
- // WRONG - Missing choicesSettings entirely
512
- "options": [
513
- {
514
- "name": "Size",
515
- "optionRenderType": "TEXT_CHOICES"
516
- }
517
- ]
518
-
519
- // WRONG - Empty choicesSettings
520
- "options": [
521
- {
522
- "name": "Size",
523
- "optionRenderType": "TEXT_CHOICES",
524
- "choicesSettings": {}
525
- }
526
- ]
527
-
528
- // WRONG - Empty choices array
529
- "options": [
530
- {
531
- "name": "Size",
532
- "optionRenderType": "TEXT_CHOICES",
533
- "choicesSettings": {
534
- "choices": []
535
- }
536
- }
537
- ]
538
- ```
539
-
540
- ### Issue 2: "optionSettings.choicesSettings.choices must not be empty" error
541
-
542
- * **Problem**: You get an error like `"product is invalid: options [at index 0] is invalid: optionSettings.choicesSettings is invalid: choices has size 0, expected 1 or more"` or `"choices must not be empty"`.
543
- * **Solution**: This error occurs when using the incorrect nested structure `optionSettings.choicesSettings` instead of the correct `choicesSettings` directly under the option.
544
-
545
- **WRONG Structure (causes the error):**
546
-
547
- ```json
548
- "options": [
549
- {
550
- "name": "Size",
551
- "optionRenderType": "TEXT_CHOICES",
552
- "optionSettings": {
553
- "choicesSettings": {
554
- "choices": []
555
- }
556
- }
557
- }
558
- ]
559
- ```
560
-
561
- **CORRECT Structure (use this instead):**
562
-
563
- ```json
564
- "options": [
565
- {
566
- "name": "Size",
567
- "optionRenderType": "TEXT_CHOICES",
568
- "choicesSettings": {
569
- "choices": [
570
- {
571
- "choiceType": "CHOICE_TEXT",
572
- "name": "Small"
573
- }
574
- ]
575
- }
576
- }
577
- ]
578
- ```
579
-
580
- **Key Points:**
581
-
582
- * Use `choicesSettings` directly under the option object, NOT nested under `optionSettings`
583
- * The `choicesSettings.choices` array MUST contain at least one choice
584
- * Each choice MUST have `choiceType` and `name` properties
585
- * Always include the complete choices array even when referencing existing customizations
586
-
587
- ### Issue 3: Variants not matching options
588
-
589
- * **Problem**: The API returns errors about variants not matching the product's options.
590
- * **Solution**:
591
- * Create one variant for each possible combination of option choices
592
- * Ensure each variant references all options defined on the product
593
- * If the product has only one option with three choices, you need three variants
594
- * Make sure each variant's option choice name exactly matches the corresponding option choice
595
-
596
- ### Issue 4: Conflicts when using existing customizations
597
-
598
- * **Problem**: When attempting to use existing customizations, you encounter name conflicts or choice conflicts.
599
- * **Solution**:
600
- * If you need to use a specific existing customization ID, first query customizations to get the correct ID
601
- * When working with existing customizations, ensure all choices you reference actually exist in that customization
602
- * If you're creating a new customization with the same name as an existing one, the API will use the existing one
603
- * Be aware that customizations are shared across all products in your store
604
-
605
- ### Issue 5: "Expected an object" error for description
606
-
607
- * **Problem**: Using a plain string for the description field causes API failure.
608
- * **Solution**: Always use the rich text nodes structure for descriptions as shown in the CRITICAL section above.
609
-
610
- ### Issue 6: Inconsistencies in documentation vs. actual API behavior
611
-
612
- * **Problem**: Several API requirements are not well-documented or are documented differently from how the API actually behaves.
613
- * **Solution**:
614
- * Always include choicesSettings with all choices when creating a product
615
- * Use optionChoiceNames rather than optionChoiceIds in variants for more reliable results
616
- * Include the renderType in optionChoiceNames
617
- * Use the exact same choice names as defined in the customization
618
-
619
- ## Conclusion
620
-
621
- Creating a Wix store product with options involves understanding the relationship between store-wide customizations and product-specific options and variants. The key is to ensure consistency between customization definitions, product options, and product variants.
622
-
623
- By following this recipe and being aware of the common pitfalls, you can successfully create a Wix store product with options.