> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# UpdateCustomizationChoices

# Package: catalogV3

# Namespace: CustomizationService

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/customizations-v3/update-customization-choices.md

## Permission Scopes:
Customization write in v3 catalog: SCOPE.STORES.CUSTOMIZATION_WRITE

## Introduction

Updates properties of existing choices in a customization.
Choices are identified by their IDs. Only the fields specified in `fieldMask` are updated.

Supports updating `name`, `primaryChoiceIds`, `colorCode`, and `displayImage`.
Updating `addedPrice` is supported only for `MODIFIER` customizations.

---

## REST API

### Schema

```
 Method: updateCustomizationChoices
 Description: Updates properties of existing choices in a customization. Choices are identified by their GUIDs. Only the fields specified in `fieldMask` are updated.  Supports updating `name`, `primaryChoiceIds`, `colorCode`, and `displayImage`. Updating `addedPrice` is supported only for `MODIFIER` customizations.
 URL: https://www.wixapis.com/stores/v3/customizations/{customizationId}/update-choices
 Method: POST
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  revision, choices, choices.choice
 Method parameters: 
   param name: choices | type: array<choices> | description: Choices to update. Each item must include a `choice` with a valid `id` matching an existing choice in the customization. | required: true | validation: minItems 1, maxItems 100
              - name: choice | type: Choice | description: Choice to update. | required: true 
                 - ONE-OF: 
                    - name: colorCode | type: string | description: Color code in HEX format, [as described by MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color).  | validation: minLength 3, maxLength 20, format COLOR_HEX
                 - name: choiceType | type: ChoiceType | description: Choice type.  > **Notes:** > + For `customizationRenderType: SWATCH_CHOICES`, the supported `choiceType` value is: `ONE_COLOR`. > + For a `customizationRenderType` of `TEXT_CHOICES`, the supported `choiceType` value is: `CHOICE_TEXT`.  | validation: immutable
                         - enum:
                         -     CHOICE_TEXT: For a `customizationRenderType` of `TEXT_CHOICES`.
                         -     ONE_COLOR: For `customizationRenderType: SWATCH_CHOICES`.
                 - name: name | type: string | description: Choice name.  | validation: minLength 1, maxLength 50
                 - name: displayImage | type: Image | description: Optional image displayed alongside a `ONE_COLOR` choice in the storefront. Only valid for `ONE_COLOR` choices; not populated for other choice types.  
                    - name: id | type: string | description: WixMedia image GUID.  | validation: maxLength 400
                    - name: url | type: string | description: Image URL.  | validation: format WEB_URL
                    - name: altText | type: string | description: Image alt text.  | validation: maxLength 200
                 - name: primaryChoiceIds | type: array<string> | description: IDs of the primary choices this choice is grouped under.  A choice that has `primaryChoiceIds` is a "linked" choice; a choice without `primaryChoiceIds` is a "primary" choice. A linked choice can reference up to 4 primary choices and appears nested under each of them on the storefront, rather than in the top-level choice list.  Only one level of grouping is supported: a primary choice cannot itself be a linked choice.  | validation: maxItems 4, format GUID
   param name: fields | type: array<fields> | description: Fields to include in the response.  Supported values: `ASSIGNED_PRODUCTS_COUNT`  | validation: maxItems 100
                 - enum:
                 -     ASSIGNED_PRODUCTS_COUNT: Assigned products count.
                 -     CHOICE_DISPLAY_IMAGE: Returns display images for choices.
   param name: revision | type: revision | description: Revision number, which increments by 1 each time the customization is updated. To prevent conflicting changes, the current revision must be passed when updating the customization. | required: true 
 Return type: UpdateCustomizationChoicesResponse
  - name: customization | type: Customization | description: Updated customization.  
     - ONE-OF: 
        - name: modifierSettings | type: ModifierSettings | description: Modifier-specific settings.  Only supported when `customizationType` is `MODIFIER`.  
           - name: defaultMandatory | type: boolean | description: Whether customer input is required for this modifier by default.  Applies to `modifiers.mandatory` on a product that uses this modifier without setting `mandatory` explicitly. A product that sets `modifiers.mandatory` overrides this default.  Default: `false`  
     - ONE-OF: 
        - name: freeTextInput | type: FreeTextSettings | description: Free text input settings.  > **Note:** To be passed along with `customizationRenderType: FREE_TEXT`.  
           - name: minCharCount | type: integer | description: Minimum text character length.  
           - name: maxCharCount | type: integer | description: Maximum text character length.  | validation: maximum 500
           - name: title | type: string | description: Title to display to customer for their free-text input.  | validation: minLength 1, maxLength 100
           - name: key | type: string | description: A read-only identifier generated from the title.  Use `key` in the `catalogReference.options` object when [integrating Catalog V3 with eCommerce APIs](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md).  | read-only: true | validation: minLength 1, maxLength 150
        - name: choicesSettings | type: ChoicesSettings | description: Choices settings.  > **Note:** Must be passed along with `customizationRenderType` of `SWATCH_CHOICES` and `TEXT_CHOICES`.  
           - name: choices | type: array<Choice> | description: List of choices.  | validation: minItems 1, maxItems 1000, immutable
              - ONE-OF: 
                 - name: colorCode | type: string | description: Color code in HEX format, [as described by MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color).  | validation: minLength 3, maxLength 20, format COLOR_HEX
              - name: id | type: string | description: Choice GUID.  | read-only: true | validation: format GUID
              - name: choiceType | type: ChoiceType | description: Choice type.  > **Notes:** > + For `customizationRenderType: SWATCH_CHOICES`, the supported `choiceType` value is: `ONE_COLOR`. > + For a `customizationRenderType` of `TEXT_CHOICES`, the supported `choiceType` value is: `CHOICE_TEXT`.  | validation: immutable
                     - enum:
                     -     CHOICE_TEXT: For a `customizationRenderType` of `TEXT_CHOICES`.
                     -     ONE_COLOR: For `customizationRenderType: SWATCH_CHOICES`.
              - name: key | type: string | description: A read-only identifier generated from the choice name.  Use `key` in the `catalogReference.options` object when [integrating Catalog V3 with eCommerce APIs](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md).  | read-only: true | validation: minLength 1, maxLength 50
              - name: name | type: string | description: Choice name.  | validation: minLength 1, maxLength 50
              - name: displayImage | type: Image | description: Optional image displayed alongside a `ONE_COLOR` choice in the storefront. Only valid for `ONE_COLOR` choices; not populated for other choice types.  
                 - name: id | type: string | description: WixMedia image GUID.  | validation: maxLength 400
                 - name: url | type: string | description: Image URL.  | validation: format WEB_URL
                 - name: height | type: integer | description: Original image height.  | read-only: true 
                 - name: width | type: integer | description: Original image width.  | read-only: true 
                 - name: altText | type: string | description: Image alt text.  | validation: maxLength 200
                 - name: filename | type: string | description: Image filename.  | read-only: true | validation: maxLength 200
              - name: primaryChoiceIds | type: array<string> | description: IDs of the primary choices this choice is grouped under.  A choice that has `primaryChoiceIds` is a "linked" choice; a choice without `primaryChoiceIds` is a "primary" choice. A linked choice can reference up to 4 primary choices and appears nested under each of them on the storefront, rather than in the top-level choice list.  Only one level of grouping is supported: a primary choice cannot itself be a linked choice.  | validation: maxItems 4, format GUID
     - name: id | type: string | description: Customization GUID.  | read-only: true | validation: minLength 1, maxLength 36
     - name: revision | type: string | description: Revision number, which increments by 1 each time the customization is updated. To prevent conflicting changes, the current revision must be passed when updating the customization.  Ignored when creating a customization.  | read-only: true | validation: format int64
     - name: createdDate | type: string | description: Date and time the customization was created.  | read-only: true | validation: format date-time
     - name: updatedDate | type: string | description: Date and time the customization was updated.  | read-only: true | validation: format date-time
     - name: key | type: string | description: A read-only identifier generated from the customization name.  Use `key` in the `catalogReference.options` object when [integrating Catalog V3 with eCommerce APIs](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md).  | read-only: true | validation: minLength 1, maxLength 50
     - name: name | type: string | description: Customization name for options (for example, `"color"`, `"size"`) and modifiers (for example, `"greeting card"`).  | validation: minLength 1, maxLength 50
     - name: customizationType | type: CustomizationType | description: Customization type.  | validation: immutable
         - enum: PRODUCT_OPTION, MODIFIER
     - name: customizationRenderType | type: CustomizationRenderType | description: Customization render type.  Defines how the customization will be displayed in the storefront.  | validation: immutable
         - enum:
         -     FREE_TEXT: Customization by free text input.
         -     TEXT_CHOICES: Customization by selection of text choices.
         -     SWATCH_CHOICES: Customization by selection of colors.
     - name: assignedProductsCount | type: integer | description: Number of products this customization is assigned to. > **Note:** Returned only when you pass `"ASSIGNED_PRODUCTS_COUNT"` to the `fields` array in Customizations API requests.  | read-only: true | validation: format int32

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PRIMARY_CHOICE_HIERARCHY_VIOLATION | Description: A choice that is a primary of other choices can't also be a linked choice. Only a single level of grouping is supported.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PRIMARY_CHOICE_NOT_FOUND | Description: `primaryChoiceIds` contains an GUID that doesn't match any existing choice in the customization.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PRIMARY_CHOICE_SELF_REFERENCE | Description: Choice references itself in `primaryChoiceIds`.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_CHOICE_FIELD | Description: `fieldMask` contains a choice field that isn't supported for update.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CHOICE_PRICE_NOT_SUPPORTED | Description: Choice prices can be updated only on modifier customizations.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CHOICE_NOT_FOUND | Description: Couldn't find 1 or more choices matching the provided GUIDs.


```

### Examples

### Update Customization Choices
Updates properties of existing choices in a customization.

```curl
curl -X POST \
 'https://www.wixapis.com/stores/v3/customizations/190facb7-1106-4ded-8ef9-cccad5c747bd/update-choices' \
 -H 'Content-Type: application/json' \
 -H 'Authorization: <AUTH>' \
 -d '{
  "revision": "2",
  "choices": [
    {
      "choice": {
        "id": "63423d24-ef4c-4d33-b924-574b525d07e5",
        "primaryChoiceIds": ["04ed47f1-32fa-4347-8f03-412b88a62fc1"]
      }
    }
  ],
  "fields": ["ASSIGNED_PRODUCTS_COUNT"]
 }'
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.stores.customizationsV3.updateCustomizationChoices(customizationId, revision, options)
 Description: Updates properties of existing choices in a customization. Choices are identified by their GUIDs. Only the fields specified in `fieldMask` are updated.  Supports updating `name`, `primaryChoiceIds`, `colorCode`, and `displayImage`. Updating `addedPrice` is supported only for `MODIFIER` customizations.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  customizationId, revision, options.choices, options.choices.choice, options
 Method parameters: 
   param name: customizationId | type: string | description: Customization GUID. | required: true | validation: format GUID
   param name: revision | type: string | description: Revision number, which increments by 1 each time the customization is updated. To prevent conflicting changes, the current revision must be passed when updating the customization. | required: true 
   param name: options | type: UpdateCustomizationChoicesOptions  none | required: true 
        - name: choices | type: array<MaskedChoice> | description: Choices to update. Each item must include a `choice` with a valid `id` matching an existing choice in the customization. | required: true | validation: minItems 1, maxItems 100
           - name: choice | type: Choice | description: Choice to update.  
              - ONE-OF: 
                 - name: colorCode | type: string | description: Color code in HEX format, [as described by MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color).  | validation: minLength 3, maxLength 20, format COLOR_HEX
              - name: choiceType | type: ChoiceType | description: Choice type.  > **Notes:** > + For `customizationRenderType: SWATCH_CHOICES`, the supported `choiceType` value is: `ONE_COLOR`. > + For a `customizationRenderType` of `TEXT_CHOICES`, the supported `choiceType` value is: `CHOICE_TEXT`.  | validation: immutable
                     - enum:
                     -     CHOICE_TEXT: For a `customizationRenderType` of `TEXT_CHOICES`.
                     -     ONE_COLOR: For `customizationRenderType: SWATCH_CHOICES`.
              - name: name | type: string | description: Choice name.  | validation: minLength 1, maxLength 50
              - name: displayImage | type: string | description: Optional image displayed alongside a `ONE_COLOR` choice in the storefront. Only valid for `ONE_COLOR` choices; not populated for other choice types.  
              - name: primaryChoiceIds | type: array<string> | description: IDs of the primary choices this choice is grouped under.  A choice that has `primaryChoiceIds` is a "linked" choice; a choice without `primaryChoiceIds` is a "primary" choice. A linked choice can reference up to 4 primary choices and appears nested under each of them on the storefront, rather than in the top-level choice list.  Only one level of grouping is supported: a primary choice cannot itself be a linked choice.  | validation: maxItems 4, format GUID
        - name: fields | type: array<RequestedFields> | description: Fields to include in the response.  Supported values: `ASSIGNED_PRODUCTS_COUNT`  | validation: maxItems 100
             - enum:
             -     ASSIGNED_PRODUCTS_COUNT: Assigned products count.
             -     CHOICE_DISPLAY_IMAGE: Returns display images for choices.
 Return type: PROMISE<UpdateCustomizationChoicesResponse>
  - name: customization | type: Customization | description: Updated customization.  
     - ONE-OF: 
        - name: modifierSettings | type: ModifierSettings | description: Modifier-specific settings.  Only supported when `customizationType` is `MODIFIER`.  
           - name: defaultMandatory | type: boolean | description: Whether customer input is required for this modifier by default.  Applies to `modifiers.mandatory` on a product that uses this modifier without setting `mandatory` explicitly. A product that sets `modifiers.mandatory` overrides this default.  Default: `false`  
     - ONE-OF: 
        - name: freeTextInput | type: FreeTextSettings | description: Free text input settings.  > **Note:** To be passed along with `customizationRenderType: FREE_TEXT`.  
           - name: minCharCount | type: integer | description: Minimum text character length.  
           - name: maxCharCount | type: integer | description: Maximum text character length.  | validation: maximum 500
           - name: title | type: string | description: Title to display to customer for their free-text input.  | validation: minLength 1, maxLength 100
           - name: key | type: string | description: A read-only identifier generated from the title.  Use `key` in the `catalogReference.options` object when [integrating Catalog V3 with eCommerce APIs](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md).  | read-only: true | validation: minLength 1, maxLength 150
        - name: choicesSettings | type: ChoicesSettings | description: Choices settings.  > **Note:** Must be passed along with `customizationRenderType` of `SWATCH_CHOICES` and `TEXT_CHOICES`.  
           - name: choices | type: array<Choice> | description: List of choices.  | validation: minItems 1, maxItems 1000, immutable
              - ONE-OF: 
                 - name: colorCode | type: string | description: Color code in HEX format, [as described by MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/hex-color).  | validation: minLength 3, maxLength 20, format COLOR_HEX
              - name: _id | type: string | description: Choice GUID.  | read-only: true | validation: format GUID
              - name: choiceType | type: ChoiceType | description: Choice type.  > **Notes:** > + For `customizationRenderType: SWATCH_CHOICES`, the supported `choiceType` value is: `ONE_COLOR`. > + For a `customizationRenderType` of `TEXT_CHOICES`, the supported `choiceType` value is: `CHOICE_TEXT`.  | validation: immutable
                     - enum:
                     -     CHOICE_TEXT: For a `customizationRenderType` of `TEXT_CHOICES`.
                     -     ONE_COLOR: For `customizationRenderType: SWATCH_CHOICES`.
              - name: key | type: string | description: A read-only identifier generated from the choice name.  Use `key` in the `catalogReference.options` object when [integrating Catalog V3 with eCommerce APIs](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md).  | read-only: true | validation: minLength 1, maxLength 50
              - name: name | type: string | description: Choice name.  | validation: minLength 1, maxLength 50
              - name: displayImage | type: string | description: Optional image displayed alongside a `ONE_COLOR` choice in the storefront. Only valid for `ONE_COLOR` choices; not populated for other choice types.  
              - name: primaryChoiceIds | type: array<string> | description: IDs of the primary choices this choice is grouped under.  A choice that has `primaryChoiceIds` is a "linked" choice; a choice without `primaryChoiceIds` is a "primary" choice. A linked choice can reference up to 4 primary choices and appears nested under each of them on the storefront, rather than in the top-level choice list.  Only one level of grouping is supported: a primary choice cannot itself be a linked choice.  | validation: maxItems 4, format GUID
     - name: _id | type: string | description: Customization GUID.  | read-only: true | validation: minLength 1, maxLength 36
     - name: revision | type: string | description: Revision number, which increments by 1 each time the customization is updated. To prevent conflicting changes, the current revision must be passed when updating the customization.  Ignored when creating a customization.  | read-only: true | validation: format int64
     - name: _createdDate | type: Date | description: Date and time the customization was created.  | read-only: true 
     - name: _updatedDate | type: Date | description: Date and time the customization was updated.  | read-only: true 
     - name: key | type: string | description: A read-only identifier generated from the customization name.  Use `key` in the `catalogReference.options` object when [integrating Catalog V3 with eCommerce APIs](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/e-commerce-integration.md).  | read-only: true | validation: minLength 1, maxLength 50
     - name: name | type: string | description: Customization name for options (for example, `"color"`, `"size"`) and modifiers (for example, `"greeting card"`).  | validation: minLength 1, maxLength 50
     - name: customizationType | type: CustomizationType | description: Customization type.  | validation: immutable
         - enum: PRODUCT_OPTION, MODIFIER
     - name: customizationRenderType | type: CustomizationRenderType | description: Customization render type.  Defines how the customization will be displayed in the storefront.  | validation: immutable
         - enum:
         -     FREE_TEXT: Customization by free text input.
         -     TEXT_CHOICES: Customization by selection of text choices.
         -     SWATCH_CHOICES: Customization by selection of colors.
     - name: assignedProductsCount | type: integer | description: Number of products this customization is assigned to. > **Note:** Returned only when you pass `"ASSIGNED_PRODUCTS_COUNT"` to the `fields` array in Customizations API requests.  | read-only: true | validation: format int32

 Possible Errors:
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PRIMARY_CHOICE_HIERARCHY_VIOLATION | Description: A choice that is a primary of other choices can't also be a linked choice. Only a single level of grouping is supported.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PRIMARY_CHOICE_NOT_FOUND | Description: `primaryChoiceIds` contains an GUID that doesn't match any existing choice in the customization.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: PRIMARY_CHOICE_SELF_REFERENCE | Description: Choice references itself in `primaryChoiceIds`.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_CHOICE_FIELD | Description: `fieldMask` contains a choice field that isn't supported for update.
   HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: CHOICE_PRICE_NOT_SUPPORTED | Description: Choice prices can be updated only on modifier customizations.
   HTTP Code: 404 | Status Code: NOT_FOUND | Application Code: CHOICE_NOT_FOUND | Description: Couldn't find 1 or more choices matching the provided GUIDs.


```

### Examples

### updateCustomizationChoices
```javascript
import { customizationsV3 } from '@wix/stores';

async function updateCustomizationChoices(customizationId,revision,options) {
  const response = await customizationsV3.updateCustomizationChoices(customizationId,revision,options);
};
```

### updateCustomizationChoices (with elevated permissions)
```javascript
import { customizationsV3 } from '@wix/stores';
import { auth } from '@wix/essentials';

async function myUpdateCustomizationChoicesMethod(customizationId,revision,options) {
  const elevatedUpdateCustomizationChoices = auth.elevate(customizationsV3.updateCustomizationChoices);
  const response = await elevatedUpdateCustomizationChoices(customizationId,revision,options);
}
```

### updateCustomizationChoices (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { customizationsV3 } from '@wix/stores';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { customizationsV3 },
  // Include the auth strategy and host as relevant
});


async function updateCustomizationChoices(customizationId,revision,options) {
  const response = await myWixClient.customizationsV3.updateCustomizationChoices(customizationId,revision,options);
};
```

---