> 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 # CreateAddOnGroup # Package: services # Namespace: AddOnGroupsService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/create-add-on-group.md ## Permission Scopes: Manage Bookings: SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS ## Introduction Creates a new add-on group for a service and updates the service's `addOnGroups` array. --- ## REST API ### Schema ``` Method: createAddOnGroup Description: Creates a new add-on group for a service and updates the service's `addOnGroups` array. URL: https://www.wixapis.com/_api/bookings/v2/services/add-on-groups/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: addOnGroup, addOnGroup.name, serviceId Method parameters: param name: addOnGroup | type: AddOnGroup | required: true - name: name | type: string | description: Name of the add-on group. | required: true - name: maxNumberOfAddOns | type: integer | description: Maximum number of different [add-ons](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/introduction.md) from the group customers can add when booking the service. When empty, there's no upper limit. - name: addOnIds | type: array | description: List of GUIDs of all [add-ons](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/introduction.md) included in the group. - name: prompt | type: string | description: Description or instructional prompt of the add-on group that's displayed to customers when booking the service. param name: serviceId | type: serviceId | description: GUID of the service to create the add-on group for. | required: true Return type: CreateAddOnGroupResponse - name: addOnGroup | type: AddOnGroup | description: Created add-on group. - name: id | type: string | description: GUID of the add-on group. Wix Bookings automatically populates this field when creating or updating an add-on group. - name: name | type: string | description: Name of the add-on group. - name: maxNumberOfAddOns | type: integer | description: Maximum number of different [add-ons](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/introduction.md) from the group customers can add when booking the service. When empty, there's no upper limit. - name: addOnIds | type: array | description: List of GUIDs of all [add-ons](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/introduction.md) included in the group. - name: prompt | type: string | description: Description or instructional prompt of the add-on group that's displayed to customers when booking the service. Possible Errors: HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SUBSCRIPTION_SERVICE_NOT_SUPPORTED | Description: none ``` ### Examples ### Create an add-on group ```curl curl -X POST 'https://www.wixapis.com/bookings/v2/services/add-on-groups/create' \ -H 'Authorization: ' \ -d '{ "addOnGroup": { "name": "Spa Treatments", "maxNumberOfAddOns": 2, "addOnIds": [ "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "b2c3d4e5-f6g7-8901-bcde-f23456789012" ], "prompt": "Choose up to 2 relaxing spa treatments to enhance your experience" }, "serviceId": "d779a301-398d-4552-aa8c-3bef0b65cedb" }' ``` ### Create an add-on group ```curl curl -X POST 'https://www.wixapis.com/bookings/v2/services/add-on-groups/create' \ -H 'Authorization: ' \ -d '{ "addOnGroup": { "name": "Spa Treatments", "maxNumberOfAddOns": 2, "addOnIds": [ "a1b2c3d4-e5f6-7890-abcd-ef1234567890", "b2c3d4e5-f6g7-8901-bcde-f23456789012" ], "prompt": "Choose up to 2 relaxing spa treatments to enhance your experience" }, "serviceId": "d779a301-398d-4552-aa8c-3bef0b65cedb" }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.services.AddOnGroupsService.createAddOnGroup(addOnGroup, options) Description: Creates a new add-on group for a service and updates the service's `addOnGroups` array. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: addOnGroup, addOnGroup.name, options.serviceId, options Method parameters: param name: addOnGroup | type: AddOnGroup | required: true - name: name | type: string | description: Name of the add-on group. | required: true - name: maxNumberOfAddOns | type: integer | description: Maximum number of different [add-ons](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/introduction.md) from the group customers can add when booking the service. When empty, there's no upper limit. - name: addOnIds | type: array | description: List of GUIDs of all [add-ons](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/introduction.md) included in the group. - name: prompt | type: string | description: Description or instructional prompt of the add-on group that's displayed to customers when booking the service. param name: options | type: CreateAddOnGroupOptions none | required: true - name: serviceId | type: string | description: GUID of the service to create the add-on group for. | required: true Return type: PROMISE - name: addOnGroup | type: AddOnGroup | description: Created add-on group. - name: _id | type: string | description: GUID of the add-on group. Wix Bookings automatically populates this field when creating or updating an add-on group. - name: name | type: string | description: Name of the add-on group. - name: maxNumberOfAddOns | type: integer | description: Maximum number of different [add-ons](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/introduction.md) from the group customers can add when booking the service. When empty, there's no upper limit. - name: addOnIds | type: array | description: List of GUIDs of all [add-ons](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/add-ons/introduction.md) included in the group. - name: prompt | type: string | description: Description or instructional prompt of the add-on group that's displayed to customers when booking the service. Possible Errors: HTTP Code: 428 | Status Code: FAILED_PRECONDITION | Application Code: SUBSCRIPTION_SERVICE_NOT_SUPPORTED | Description: none ``` ### Examples ### createAddOnGroup ```javascript import { services } from '@wix/bookings'; async function createAddOnGroup(addOnGroup,options) { const response = await services.createAddOnGroup(addOnGroup,options); }; ``` ### createAddOnGroup (with elevated permissions) ```javascript import { services } from '@wix/bookings'; import { auth } from '@wix/essentials'; async function myCreateAddOnGroupMethod(addOnGroup,options) { const elevatedCreateAddOnGroup = auth.elevate(services.createAddOnGroup); const response = await elevatedCreateAddOnGroup(addOnGroup,options); } ``` ### createAddOnGroup (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 { services } from '@wix/bookings'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { services }, // Include the auth strategy and host as relevant }); async function createAddOnGroup(addOnGroup,options) { const response = await myWixClient.services.createAddOnGroup(addOnGroup,options); }; ``` ---