> 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 # BulkCreateAddOns # Package: services # Namespace: AddOnsService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/bulk-create-add-ons.md ## Permission Scopes: Manage Bookings: SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS ## Introduction Creates multiple add-ons in a single request. --- ## REST API ### Schema ``` Method: bulkCreateAddOns Description: Creates multiple add-ons in a single request. URL: https://www.wixapis.com/addons/v1/bulk/add-ons/create Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: addOns Method parameters: param name: addOns | type: array | description: List of add-ons to create. | required: true - ONE-OF: - name: durationInMinutes | type: integer | description: Duration in minutes for duration-based add-ons that extend offering time. - name: maxQuantity | type: integer | description: Maximum quantity customers can purchase for quantity-based add-ons. - name: name | type: string | description: Display name of the add-on shown to customers. - name: price | type: Money | description: Pricing information for the add-on. - name: value | type: string | description: Add-on price amount as a decimal string with period as decimal separator. For example, `3.99` for a $3.99 add-on or `15.00` for a $15.00 add-on. - name: currency | type: string | description: Currency code for the add-on price. Must be a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code. For example, `USD` for US dollars or `EUR` for euros. - name: formattedValue | type: string | description: Add-on price amount as a decimal string in local format for display purposes. For example, `$3.99` for US format or `3,99 €` for European format. - name: taxGroup | type: string | description: GUID of the [tax group](https://dev.wix.com/docs/rest/business-solutions/e-commerce/extensions/tax/tax-groups/introduction.md) to categorize the add-on for tax calculation in [Wix eCommerce](https://dev.wix.com/docs/rest/business-solutions/e-commerce/introduction.md). Learn more about [how Wix eCommerce implements tax calculation](https://dev.wix.com/docs/rest/business-solutions/e-commerce/extensions/tax/introduction.md). This field doesn't apply to custom checkout/billing implementations. - name: extendedFields | type: ExtendedFields | description: Data extensions enabling users to save custom data related to the add-on. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: Tags | description: [Tags](https://dev.wix.com/docs/rest/business-management/tags/introduction.md) assigned to add-ons for categorization and filtering purposes. - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors. - name: tagIds | type: array | description: List of tag GUIDs. - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. param name: returnEntity | type: returnEntity | description: Whether to return the created add-ons in the response. Return type: BulkCreateAddOnsResponse - name: results | type: array | description: Results of the bulk create operation including add-ons and metadata. - name: itemMetadata | type: ItemMetadata | description: Metadata for the individual create operation. - 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: item | type: AddOn | description: Created add-on. Only present if `return_entity` was set to true in the request. - ONE-OF: - name: durationInMinutes | type: integer | description: Duration in minutes for duration-based add-ons that extend offering time. - name: maxQuantity | type: integer | description: Maximum quantity customers can purchase for quantity-based add-ons. - name: id | type: string | description: Add-on GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the add-on is updated. To prevent conflicting changes, the current revision must be passed when updating the add-on. Ignored when creating an add-on. - name: createdDate | type: string | description: Date and time the add-on was created in `YYYY-MM-DDThh:mm:ss.sssZ` format. - name: updatedDate | type: string | description: Date and time the add-on was last updated in `YYYY-MM-DDThh:mm:ss.sssZ` format. - name: name | type: string | description: Display name of the add-on shown to customers. - name: price | type: Money | description: Pricing information for the add-on. - name: value | type: string | description: Add-on price amount as a decimal string with period as decimal separator. For example, `3.99` for a $3.99 add-on or `15.00` for a $15.00 add-on. - name: currency | type: string | description: Currency code for the add-on price. Must be a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code. For example, `USD` for US dollars or `EUR` for euros. - name: formattedValue | type: string | description: Add-on price amount as a decimal string in local format for display purposes. For example, `$3.99` for US format or `3,99 €` for European format. - name: taxGroup | type: string | description: GUID of the [tax group](https://dev.wix.com/docs/rest/business-solutions/e-commerce/extensions/tax/tax-groups/introduction.md) to categorize the add-on for tax calculation in [Wix eCommerce](https://dev.wix.com/docs/rest/business-solutions/e-commerce/introduction.md). Learn more about [how Wix eCommerce implements tax calculation](https://dev.wix.com/docs/rest/business-solutions/e-commerce/extensions/tax/introduction.md). This field doesn't apply to custom checkout/billing implementations. - name: extendedFields | type: ExtendedFields | description: Data extensions enabling users to save custom data related to the add-on. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: Tags | description: [Tags](https://dev.wix.com/docs/rest/business-management/tags/introduction.md) assigned to add-ons for categorization and filtering purposes. - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors. - name: tagIds | type: array | description: List of tag GUIDs. - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. - name: bulkActionMetadata | type: BulkActionMetadata | description: Metadata for the bulk create operation. - 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. ``` ### Examples ### Create multiple add-ons ```curl curl -X POST \ 'https://www.wixapis.com/add-ons-service/v1/bulk/add-ons/create' \ -H 'Authorization: ' \ -H 'Content-Type: application/json' \ --data-binary '{ "addOns": [ { "name": "Yoga Mat Rental", "price": { "value": "800", "currency": "USD", "formattedValue": "$8.00" }, "maxQuantity": 1, "taxGroup": "12345678-1234-1234-1234-123456789012" }, { "name": "Personal Training Add-on (30 minutes)", "price": { "value": "5000", "currency": "USD", "formattedValue": "$50.00" }, "durationInMinutes": 30, "taxGroup": "12345678-1234-1234-1234-123456789012" } ], "returnEntity": true }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.services.AddOnsService.bulkCreateAddOns(addOns, options) Description: Creates multiple add-ons in a single request. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: addOns Method parameters: param name: addOns | type: array | description: List of add-ons to create. | required: true - ONE-OF: - name: durationInMinutes | type: integer | description: Duration in minutes for duration-based add-ons that extend offering time. - name: maxQuantity | type: integer | description: Maximum quantity customers can purchase for quantity-based add-ons. - name: name | type: string | description: Display name of the add-on shown to customers. - name: price | type: Money | description: Pricing information for the add-on. - name: value | type: string | description: Add-on price amount as a decimal string with period as decimal separator. For example, `3.99` for a $3.99 add-on or `15.00` for a $15.00 add-on. - name: currency | type: string | description: Currency code for the add-on price. Must be a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code. For example, `USD` for US dollars or `EUR` for euros. - name: formattedValue | type: string | description: Add-on price amount as a decimal string in local format for display purposes. For example, `$3.99` for US format or `3,99 €` for European format. - name: taxGroup | type: string | description: GUID of the [tax group](https://dev.wix.com/docs/rest/business-solutions/e-commerce/extensions/tax/tax-groups/introduction.md) to categorize the add-on for tax calculation in [Wix eCommerce](https://dev.wix.com/docs/rest/business-solutions/e-commerce/introduction.md). Learn more about [how Wix eCommerce implements tax calculation](https://dev.wix.com/docs/rest/business-solutions/e-commerce/extensions/tax/introduction.md). This field doesn't apply to custom checkout/billing implementations. - name: extendedFields | type: ExtendedFields | description: Data extensions enabling users to save custom data related to the add-on. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: Tags | description: [Tags](https://dev.wix.com/docs/rest/business-management/tags/introduction.md) assigned to add-ons for categorization and filtering purposes. - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors. - name: tagIds | type: array | description: List of tag GUIDs. - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. param name: options | type: BulkCreateAddOnsOptions none - name: returnEntity | type: boolean | description: Whether to return the created add-ons in the response. Return type: PROMISE - name: results | type: array | description: Results of the bulk create operation including add-ons and metadata. - name: itemMetadata | type: ItemMetadata | description: Metadata for the individual create operation. - 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: item | type: AddOn | description: Created add-on. Only present if `return_entity` was set to true in the request. - ONE-OF: - name: durationInMinutes | type: integer | description: Duration in minutes for duration-based add-ons that extend offering time. - name: maxQuantity | type: integer | description: Maximum quantity customers can purchase for quantity-based add-ons. - name: _id | type: string | description: Add-on GUID. - name: revision | type: string | description: Revision number, which increments by 1 each time the add-on is updated. To prevent conflicting changes, the current revision must be passed when updating the add-on. Ignored when creating an add-on. - name: _createdDate | type: Date | description: Date and time the add-on was created in `YYYY-MM-DDThh:mm:ss.sssZ` format. - name: _updatedDate | type: Date | description: Date and time the add-on was last updated in `YYYY-MM-DDThh:mm:ss.sssZ` format. - name: name | type: string | description: Display name of the add-on shown to customers. - name: price | type: Money | description: Pricing information for the add-on. - name: value | type: string | description: Add-on price amount as a decimal string with period as decimal separator. For example, `3.99` for a $3.99 add-on or `15.00` for a $15.00 add-on. - name: currency | type: string | description: Currency code for the add-on price. Must be a valid [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code. For example, `USD` for US dollars or `EUR` for euros. - name: formattedValue | type: string | description: Add-on price amount as a decimal string in local format for display purposes. For example, `$3.99` for US format or `3,99 €` for European format. - name: taxGroup | type: string | description: GUID of the [tax group](https://dev.wix.com/docs/rest/business-solutions/e-commerce/extensions/tax/tax-groups/introduction.md) to categorize the add-on for tax calculation in [Wix eCommerce](https://dev.wix.com/docs/rest/business-solutions/e-commerce/introduction.md). Learn more about [how Wix eCommerce implements tax calculation](https://dev.wix.com/docs/rest/business-solutions/e-commerce/extensions/tax/introduction.md). This field doesn't apply to custom checkout/billing implementations. - name: extendedFields | type: ExtendedFields | description: Data extensions enabling users to save custom data related to the add-on. - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured. You can only access fields for which you have the appropriate permissions. Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md). - name: tags | type: Tags | description: [Tags](https://dev.wix.com/docs/rest/business-management/tags/introduction.md) assigned to add-ons for categorization and filtering purposes. - name: privateTags | type: TagList | description: Tags that require an additional permission in order to access them, normally not given to site members or visitors. - name: tagIds | type: array | description: List of tag GUIDs. - name: tags | type: TagList | description: Tags that are exposed to anyone who has access to the labeled entity itself, including site members and visitors. - name: bulkActionMetadata | type: BulkActionMetadata | description: Metadata for the bulk create operation. - 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. ``` ### Examples ### bulkCreateAddOns ```javascript import { addOns } from '@wix/bookings'; async function bulkCreateAddOns(addOns,options) { const response = await addOns.bulkCreateAddOns(addOns,options); }; ``` ### bulkCreateAddOns (with elevated permissions) ```javascript import { addOns } from '@wix/bookings'; import { auth } from '@wix/essentials'; async function myBulkCreateAddOnsMethod(addOns,options) { const elevatedBulkCreateAddOns = auth.elevate(addOns.bulkCreateAddOns); const response = await elevatedBulkCreateAddOns(addOns,options); } ``` ### bulkCreateAddOns (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 { addOns } from '@wix/bookings'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { addOns }, // Include the auth strategy and host as relevant }); async function bulkCreateAddOns(addOns,options) { const response = await myWixClient.addOns.bulkCreateAddOns(addOns,options); }; ``` ---