> 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`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # BulkAddCustomizationChoices # Package: catalogV3 # Namespace: CustomizationService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v3/customizations-v3/bulk-add-customization-choices.md ## Permission Scopes: Customization write in v3 catalog: SCOPE.STORES.CUSTOMIZATION_WRITE ## Introduction Adds choices to multiple customizations. --- ## REST API ### Schema ``` Method: bulkAddCustomizationChoices Description: Adds choices to multiple customizations. URL: https://www.wixapis.com/stores/v3/bulk/customizations/add-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: customizationsChoices, customizationsChoices.customizationId, customizationsChoices.choices Method parameters: param name: customizationsChoices | type: array | description: List of customization GUIDs and choices. | required: true - name: customizationId | type: string | description: Customization GUID. | required: true - name: choices | type: array | description: Choices to add. | 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). - 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`. - enum: - CHOICE_TEXT: For a `customizationRenderType` of `TEXT_CHOICES`. - ONE_COLOR: For `customizationRenderType: SWATCH_CHOICES`. - name: name | type: string | description: Choice name. - name: defaultAddedPrice | type: string | description: Default amount added to a product's price when this customization is assigned to a modifier. - 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. - name: url | type: string | description: Image URL. - name: altText | type: string | description: Image alt text. - name: primaryChoiceIds | type: array | 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. param name: fields | type: array | description: Fields to include in the response. Supported values: `ASSIGNED_PRODUCTS_COUNT` - enum: - ASSIGNED_PRODUCTS_COUNT: Assigned products count. - CHOICE_DISPLAY_IMAGE: Returns display images for choices. param name: returnEntity | type: returnEntity | description: Whether to return the full customization entities in the response. Default: `false` Return type: BulkAddCustomizationChoicesResponse - name: results | type: array | description: Customizations updated by bulk action. - name: itemMetadata | type: ItemMetadata | description: Bulk action metadata for customization. - name: id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item). - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items. - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated. - name: error | type: ApplicationError | description: Details about the error in case of failure. - name: code | type: string | description: Error code. - name: description | type: string | description: Description of the error. - name: data | type: object | description: Data related to the error. - name: customization | type: Customization | description: Full customization entity. Returned only if `returnEntity: true` is passed in the request. - 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. - name: defaultAddedPrice | type: string | description: Default amount added to a product's price when this choice is assigned to a modifier. - name: title | type: string | description: Title to display to customer for their free-text input. - 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). - name: choicesSettings | type: ChoicesSettings | description: Choices settings. > **Note:** Must be passed along with `customizationRenderType` of `SWATCH_CHOICES` and `TEXT_CHOICES`. - name: choices | type: array | description: List of choices. - 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). - name: id | type: string | description: Choice 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`. - 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). - name: name | type: string | description: Choice name. - name: defaultAddedPrice | type: string | description: Default amount added to a product's price when this customization is assigned to a modifier. - 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. - name: url | type: string | description: Image URL. - name: height | type: integer | description: Original image height. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. - name: filename | type: string | description: Image filename. - name: primaryChoiceIds | type: array | 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. - name: id | type: string | description: Customization GUID. - 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. - name: createdDate | type: string | description: Date and time the customization was created. - name: updatedDate | type: string | description: Date and time the customization was updated. - 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). - name: name | type: string | description: Customization name for options (for example, `"color"`, `"size"`) and modifiers (for example, `"greeting card"`). - name: customizationType | type: CustomizationType | description: Customization type. - enum: PRODUCT_OPTION, MODIFIER - name: customizationRenderType | type: CustomizationRenderType | description: Customization render type. Defines how the customization will be displayed in the storefront. - 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. - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata. - name: totalSuccesses | type: integer | description: Number of items that were successfully processed. - name: totalFailures | type: integer | description: Number of items that couldn't be processed. - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded. 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: INVALID_CHOICE_VALUE | Description: Choice value doesn't match the choice type. For `SWATCH_CHOICES`, use `ONE_COLOR` choice type. For `TEXT_CHOICES`, use `CHOICE_TEXT` choice type. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_CHOICE_TYPE | Description: Choice type doesn't match the customization type. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: DOESNT_SUPPORT_CHOICES | Description: `FREE_TEXT` render type doesn't support choices. Use `SWATCH_CHOICES` or `TEXT_CHOICES` render type instead. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CHOICES_LIMIT_EXCEEDED | Description: Number of choices exceeded the limit of 100 per customization. ``` ### Examples ### Bulk Add Customization Choices Adds given sets of choices to their matching customizations, with return entity ```curl curl -X POST \ 'https://www.wixapis.com/stores/v3/bulk/customizations/add-choices' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "customizationsChoices": [ { "choices": [ { "choiceType": "CHOICE_TEXT", "name": "Extra Slim" } ], "customizationId": "a17b9a5f-85c3-4e54-b914-1a9d3e1b6f26" }, { "choices": [ { "name": "Purple", "choiceType": "ONE_COLOR", "colorCode": "#A020F0" }, { "choiceType": "ONE_COLOR", "name": "Orange", "colorCode": "#FFA500" } ], "customizationId": "55e1b16b-0804-48d5-9b62-0a869d5875c0" } ], "returnEntity": true }' ``` ### Bulk Add Customization Choices Adds given sets of choices to their matching customizations, without return entity ```curl curl -X POST \ 'https://www.wixapis.com/stores/v3/bulk/customizations/add-choices' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d '{ "customizationsChoices": [ { "choices": [ { "choiceType": "CHOICE_TEXT", "name": "Extra Slim" } ], "customizationId": "a17b9a5f-85c3-4e54-b914-1a9d3e1b6f26" }, { "choices": [ { "name": "Purple", "choiceType": "ONE_COLOR", "colorCode": "#A020F0" }, { "choiceType": "ONE_COLOR", "name": "Orange", "colorCode": "#FFA500" } ], "customizationId": "a17b9a5f-85c3-4e54-b914-1a9d3e1b6f26" } ] }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.catalogV3.CustomizationService.bulkAddCustomizationChoices(customizationsChoices, options) Description: Adds choices to multiple customizations. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: customizationsChoices, customizationsChoices.customizationId, customizationsChoices.choices Method parameters: param name: customizationsChoices | type: array | description: List of customization GUIDs and choices. | required: true - name: customizationId | type: string | description: Customization GUID. | required: true - name: choices | type: array | description: Choices to add. | 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). - 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`. - enum: - CHOICE_TEXT: For a `customizationRenderType` of `TEXT_CHOICES`. - ONE_COLOR: For `customizationRenderType: SWATCH_CHOICES`. - name: name | type: string | description: Choice name. - name: defaultAddedPrice | type: string | description: Default amount added to a product's price when this customization is assigned to a modifier. - 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 | 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. param name: options | type: BulkAddCustomizationChoicesOptions none - name: returnEntity | type: boolean | description: Whether to return the full customization entities in the response. Default: `false` - name: fields | type: array | description: Fields to include in the response. Supported values: `ASSIGNED_PRODUCTS_COUNT` - enum: - ASSIGNED_PRODUCTS_COUNT: Assigned products count. - CHOICE_DISPLAY_IMAGE: Returns display images for choices. Return type: PROMISE - name: results | type: array | description: Customizations updated by bulk action. - name: itemMetadata | type: ItemMetadata | description: Bulk action metadata for customization. - name: _id | type: string | description: Item GUID. Should always be available, unless it's impossible (for example, when failing to create an item). - name: originalIndex | type: integer | description: Index of the item within the request array. Allows for correlation between request and response items. - name: success | type: boolean | description: Whether the requested action was successful for this item. When `false`, the `error` field is populated. - name: error | type: ApplicationError | description: Details about the error in case of failure. - name: code | type: string | description: Error code. - name: description | type: string | description: Description of the error. - name: data | type: object | description: Data related to the error. - name: customization | type: Customization | description: Full customization entity. Returned only if `returnEntity: true` is passed in the request. - 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. - name: defaultAddedPrice | type: string | description: Default amount added to a product's price when this choice is assigned to a modifier. - name: title | type: string | description: Title to display to customer for their free-text input. - 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). - name: choicesSettings | type: ChoicesSettings | description: Choices settings. > **Note:** Must be passed along with `customizationRenderType` of `SWATCH_CHOICES` and `TEXT_CHOICES`. - name: choices | type: array | description: List of choices. - 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). - name: _id | type: string | description: Choice 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`. - 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). - name: name | type: string | description: Choice name. - name: defaultAddedPrice | type: string | description: Default amount added to a product's price when this customization is assigned to a modifier. - 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 | 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. - name: _id | type: string | description: Customization GUID. - 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. - name: _createdDate | type: Date | description: Date and time the customization was created. - name: _updatedDate | type: Date | description: Date and time the customization was updated. - 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). - name: name | type: string | description: Customization name for options (for example, `"color"`, `"size"`) and modifiers (for example, `"greeting card"`). - name: customizationType | type: CustomizationType | description: Customization type. - enum: PRODUCT_OPTION, MODIFIER - name: customizationRenderType | type: CustomizationRenderType | description: Customization render type. Defines how the customization will be displayed in the storefront. - 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. - name: bulkActionMetadata | type: BulkActionMetadata | description: Bulk action metadata. - name: totalSuccesses | type: integer | description: Number of items that were successfully processed. - name: totalFailures | type: integer | description: Number of items that couldn't be processed. - name: undetailedFailures | type: integer | description: Number of failures without details because detailed failure threshold was exceeded. 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: INVALID_CHOICE_VALUE | Description: Choice value doesn't match the choice type. For `SWATCH_CHOICES`, use `ONE_COLOR` choice type. For `TEXT_CHOICES`, use `CHOICE_TEXT` choice type. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: INVALID_CHOICE_TYPE | Description: Choice type doesn't match the customization type. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: DOESNT_SUPPORT_CHOICES | Description: `FREE_TEXT` render type doesn't support choices. Use `SWATCH_CHOICES` or `TEXT_CHOICES` render type instead. HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: CHOICES_LIMIT_EXCEEDED | Description: Number of choices exceeded the limit of 100 per customization. ``` ### Examples ### Bulk add customization choices Adds sets of choices to their matching customizations ```javascript import { customizationsV3 } from "@wix/stores"; const customizationsChoices = [ { choices: [ { choiceType: "CHOICE_TEXT", name: "Extra Slim" } ], customizationId: "a17b9a5f-85c3-4e54-b914-1a9d3e1b6f26" }, { choices: [ { name: "Purple", choiceType: "ONE_COLOR", colorCode: "#A020F0" }, { choiceType: "ONE_COLOR", name: "Orange", colorCode: "#FFA500" } ], customizationId: "a17b9a5f-85c3-4e54-b914-1a9d3e1b6f26" } ]; async function bulkAddCustomizationChoices() { const response = await customizationsV3.bulkAddCustomizationChoices(customizationsChoices); } /* Promise resolves to: * { * "results": [ * { * "itemMetadata": { * "id": "a17b9a5f-85c3-4e54-b914-1a9d3e1b6f26", * "originalIndex": 0, * "success": true * } * }, * { * "itemMetadata": { * "id": "a17b9a5f-85c3-4e54-b914-1a9d3e1b6f26", * "originalIndex": 1, * "success": true * } * } * ], * "bulkActionMetadata": { * "totalSuccesses": 2, * "totalFailures": 0 * } * } */ ``` ### bulkAddCustomizationChoices (self-hosted) Self-hosted 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 bulkAddCustomizationChoices(customizationsChoices,options) { const response = await myWixClient.customizationsV3.bulkAddCustomizationChoices(customizationsChoices,options); }; ``` ---