> 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 # CreateServiceOptionsAndVariants # Package: services # Namespace: ServiceOptionsAndVariantsService # Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/create-service-options-and-variants.md ## Permission Scopes: Manage Bookings Services and Settings: SCOPE.BOOKINGS.CONFIGURATION ## Introduction Creates a `serviceOptionsAndVariants` object and for a service. --- ## REST API ### Schema ``` Method: createServiceOptionsAndVariants Description: Creates a `serviceOptionsAndVariants` object and for a service. ### Calculate variants Before creating a `serviceOptionsAndVariants` object, you need to anticipate and manually define all its variants, since Wix Bookings doesn't automatically calculate them. For the actual Create Service Options And Variants* call, specify both the `options` and `variants` arrays. ### Limitations Wix Bookings allows you to connect only a single `serviceOptionsAndVariants` object to a service. *Create Service Options And Variants* fails, if the service already has a connected `serviceOptionsAndVariants` object. Currently, you can include only a single option per `serviceOptionsAndVariants` object. Taken together, this means that services are limited to a single option. ### Option GUID When creating a`serviceOptionsAndVariants` object, you must specify an GUID in [UUGUID format](https://en.wikipedia.org/wiki/Universally_unique_identifier) for its only option. You must reference this option GUID for each variant as `variants.values.choices.optionId`. ### Staff member option To create an option based on the [staff member](https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/introduction.md) providing the service, you need to specify `STAFF_MEMBER` as `options.values.type`. Also, specify the [resource](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction.md) GUIDs associated with the relevant staff members as `variants.values.choices.staffMemberId`. You could follow this [sample flow](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/sample-flows.md#create-staff-member-based-service-variants). ### Custom option To create an option based on a custom parameter, specify `CUSTOM` as `options.values.type`. Provide descriptive names for all custom choices as `variants.values.choices.custom`. These names are displayed to customers during the book flow. You could follow this [sample flow](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/sample-flows.md#create-service-variants-based-on-the-booked-equipment). ### Duration option To create an option based on appointment duration, specify `DURATION` as `options.values.type` and set a descriptive name in `options.values.durationData.name`. Also, indicate the appointment length in `minutes` and provide a descriptive `name` for each duration choice in `variants.values.choices.duration`. URL: https://www.wixapis.com/bookings/v1/serviceOptionsAndVariants Method: POST # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: serviceOptionsAndVariants, serviceOptionsAndVariants.serviceId, serviceOptionsAndVariants.options, serviceOptionsAndVariants.variants Method parameters: param name: serviceOptionsAndVariants | type: ServiceOptionsAndVariants | description: The `serviceOptionsAndVariants` object links a [service](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) to its variants. You can use it to offer customers different prices for a service, depending on which choices they book. | required: true - name: serviceId | type: string | description: GUID of the service related to these options and variants. | required: true - name: options | type: ServiceOptions | description: Service options. Note that currently only a single option is supported per service. | required: true - name: values | type: array | description: Values of the service options. Max: 1 service option - ONE-OF: - name: customData | type: CustomServiceOption | description: Details about the custom option. Available only for `CUSTOM` options. - name: name | type: string | description: Name of the service option. For example, `Age group`, `Location`, `Equipment`, or `Time`. - name: choices | type: array | description: Available choices for the service option. For example, `child`, `student`, `adult`, and `senior` for a service option named `Age group`. Each value must be unique. The value's case is ignored, meaning `Child` and `child` are considered to be identical. Currently, only a single choice is supported because a service can have only a single option. Max: 1 choice - name: durationData | type: DurationServiceOption | description: - name: name | type: string | description: Optional name of the duration option. For example, `Short Class`, or `Extended Class`. - name: id | type: string | description: GUID of the service option. - name: type | type: ServiceOptionType | description: Type of the service option. - enum: - UNKNOWN: There is no information about the option type. - CUSTOM: The service option is based on a custom parameter. For example, age group, booked equipment, or appointment timing. - STAFF_MEMBER: It's a [staff member](https://dev.wix.com/docs/rest/business-solutions/bookings/staff-members/introduction.md) based option. - DURATION: It's a duration-based option. - name: variants | type: ServiceVariants | description: Information about the service's variants. | required: true - name: values | type: array | description: Values of the service variants. - name: choices | type: array | description: Choices for the service option. Currently, only a single choice is supported because a service can have only a single option. Max: 1 choice - ONE-OF: - name: custom | type: string | description: Name of the custom choice. - name: staffMemberId | type: string | description: GUID of the [resource](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction.md) associated with the [staff member](https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/introduction.md) providing the service. - name: duration | type: Duration | description: Information about the option's duration. - name: minutes | type: integer | description: Duration of the service in minutes. Min: `1` minute Max: `44639` minutes (30 days, 23 hours, and 59 minutes) - name: name | type: string | description: Name of the duration option. Default: Human-readable text of `minutes`. For example, `1 hr 30 min`. - name: optionId | type: string | description: GUID of the service option. - name: price | type: Money | description: Information about the service variant's price. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. - name: revision | type: string | description: Revision number, which increments by 1 each time the `serviceOptionsAndVariants` object is updated. To prevent conflicting changes, the current revision must be passed when updating and deleting the `serviceOptionsAndVariants` object. Ignored when creating a `serviceOptionsAndVariants` object. - name: extendedFields | type: ExtendedFields | description: Extensions enabling users to save custom data related to service options and variants. - 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). Return type: CreateServiceOptionsAndVariantsResponse - name: serviceOptionsAndVariants | type: ServiceOptionsAndVariants | description: Information about the created service options and variants. - name: id | type: string | description: GUID of the `serviceOptionsAndVariants` object. - name: serviceId | type: string | description: GUID of the service related to these options and variants. - name: options | type: ServiceOptions | description: Service options. Note that currently only a single option is supported per service. - name: values | type: array | description: Values of the service options. Max: 1 service option - ONE-OF: - name: customData | type: CustomServiceOption | description: Details about the custom option. Available only for `CUSTOM` options. - name: name | type: string | description: Name of the service option. For example, `Age group`, `Location`, `Equipment`, or `Time`. - name: choices | type: array | description: Available choices for the service option. For example, `child`, `student`, `adult`, and `senior` for a service option named `Age group`. Each value must be unique. The value's case is ignored, meaning `Child` and `child` are considered to be identical. Currently, only a single choice is supported because a service can have only a single option. Max: 1 choice - name: durationData | type: DurationServiceOption | description: - name: name | type: string | description: Optional name of the duration option. For example, `Short Class`, or `Extended Class`. - name: id | type: string | description: GUID of the service option. - name: type | type: ServiceOptionType | description: Type of the service option. - enum: - UNKNOWN: There is no information about the option type. - CUSTOM: The service option is based on a custom parameter. For example, age group, booked equipment, or appointment timing. - STAFF_MEMBER: It's a [staff member](https://dev.wix.com/docs/rest/business-solutions/bookings/staff-members/introduction.md) based option. - DURATION: It's a duration-based option. - name: variants | type: ServiceVariants | description: Information about the service's variants. - name: values | type: array | description: Values of the service variants. - name: choices | type: array | description: Choices for the service option. Currently, only a single choice is supported because a service can have only a single option. Max: 1 choice - ONE-OF: - name: custom | type: string | description: Name of the custom choice. - name: staffMemberId | type: string | description: GUID of the [resource](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction.md) associated with the [staff member](https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/introduction.md) providing the service. - name: duration | type: Duration | description: Information about the option's duration. - name: minutes | type: integer | description: Duration of the service in minutes. Min: `1` minute Max: `44639` minutes (30 days, 23 hours, and 59 minutes) - name: name | type: string | description: Name of the duration option. Default: Human-readable text of `minutes`. For example, `1 hr 30 min`. - name: optionId | type: string | description: GUID of the service option. - name: price | type: Money | description: Information about the service variant's price. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. - name: minPrice | type: Money | description: Price of the cheapest service variant. - name: maxPrice | type: Money | description: Price of the most expensive service variant. - name: revision | type: string | description: Revision number, which increments by 1 each time the `serviceOptionsAndVariants` object is updated. To prevent conflicting changes, the current revision must be passed when updating and deleting the `serviceOptionsAndVariants` object. Ignored when creating a `serviceOptionsAndVariants` object. - name: extendedFields | type: ExtendedFields | description: Extensions enabling users to save custom data related to service options and variants. - 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). Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_OPTION_DATA | Description: Specifying `customData` isn't supported for the passed `options.values.type`. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_CUSTOM_CHOICES | Description: All custom choices must be specified in the `variants` array. Either add missing variants or remove unnecessary choices. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: IDENTICAL_CHOICES | Description: Remove identical choices from the request. Note that choices aren't case sensitive. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_STAFF_VARIANTS | Description: All staff members providing the service must have their associated resource GUIDs specified in the `variants` array. Either add missing resource GUIDs to `variants.values.choices.staffMemberId`, or remove them from the service schedule's `scheduleOwnerId`s in the active schedule's `availability.linkedSchedules` array. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNKNOWN_STAFF_IDS | Description: All resource GUIDs passed in `variants.values.choices.staffMemberId` must be connected to the service's schedule, defined as `scheduleOwnerId` in the active schedule's `availability.linkedSchedules` array. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_OPTION_TYPE | Description: The specified option type isn't supported for the passed service. Staff member based variants require that the service's schedule has staff members defined as `scheduleOwnerId` in the active schedule's `availability.linkedSchedules` array. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MULTIPLE_CURRENCIES | Description: Multiple currencies in the `variants` array. All variants must use the same currency. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNKNOWN_OPTION_IDS | Description: Unknown option GUIDs in the `variants` array. ``` ### Examples ### Create custom options and variants for a service ```curl curl -X POST \ 'https://wixapis.com/bookings/v1/serviceOptionsAndVariants' \ -H 'Authorization: ' \ -d '{ "serviceOptionsAndVariants": { "serviceId": "6072fbad-5c95-4bf6-a9bc-4280aadc1ae8", "options": { "values": [ { "customData": { "choices": ["Student","Adult"], "name": "Customer Type" }, "id": "0b78af72-0ba0-4e71-ba39-b4386555a353", "type": "CUSTOM" } ] }, "variants": { "values": [ { "choices": [ { "optionId": "0b78af72-0ba0-4e71-ba39-b4386555a353", "custom": "Student" } ], "price": { "currency": "EUR", "value": "3" } }, { "choices": [ { "optionId": "0b78af72-0ba0-4e71-ba39-b4386555a353", "custom": "Adult" } ], "price": { "currency": "EUR", "value": "12" } } ] } } }' ``` ### Create staff member-based options and variants for a service ```curl curl -X POST \ 'https://wixapis.com/bookings/v1/serviceOptionsAndVariants' \ -H 'Authorization: ' \ -d '{ "serviceOptionsAndVariants": { "serviceId": "33340481-e57e-4285-8e31-4f0b5ca0a6b5", "options": { "values": [ { "id": "ae6ecb80-5013-4e6c-95f4-20708583f72d", "type": "STAFF_MEMBER" } ] }, "variants": { "values": [ { "choices": [ { "staffMemberId": "5a79026c-36f9-4839-ad4a-9a3132af5895", "optionId": "ae6ecb80-5013-4e6c-95f4-20708583f72d" } ], "price": { "currency": "EUR", "value": "55" } }, { "choices": [ { "staffMemberId": "963c5a66-e4be-490c-9e79-556c9a4d8807", "optionId": "ae6ecb80-5013-4e6c-95f4-20708583f72d" } ], "price": { "currency": "EUR", "value": "105" } }, { "choices": [ { "staffMemberId": "59581285-876b-4581-8f4c-cf90452d94e9", "optionId": "ae6ecb80-5013-4e6c-95f4-20708583f72d" } ], "price": { "currency": "EUR", "value": "50" } }, { "choices": [ { "staffMemberId": "9a3d4d6c-0ff9-4671-9fad-0aa2cbcd8b0f", "optionId": "ae6ecb80-5013-4e6c-95f4-20708583f72d" } ], "price": { "currency": "EUR", "value": "60" } } ] } } }' ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.services.ServiceOptionsAndVariantsService.createServiceOptionsAndVariants(serviceOptionsAndVariants) Description: Creates a `serviceOptionsAndVariants` object and for a service. ### Calculate variants Before creating a `serviceOptionsAndVariants` object, you need to anticipate and manually define all its variants, since Wix Bookings doesn't automatically calculate them. For the actual Create Service Options And Variants* call, specify both the `options` and `variants` arrays. ### Limitations Wix Bookings allows you to connect only a single `serviceOptionsAndVariants` object to a service. *Create Service Options And Variants* fails, if the service already has a connected `serviceOptionsAndVariants` object. Currently, you can include only a single option per `serviceOptionsAndVariants` object. Taken together, this means that services are limited to a single option. ### Option GUID When creating a`serviceOptionsAndVariants` object, you must specify an GUID in [UUGUID format](https://en.wikipedia.org/wiki/Universally_unique_identifier) for its only option. You must reference this option GUID for each variant as `variants.values.choices.optionId`. ### Staff member option To create an option based on the [staff member](https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/introduction.md) providing the service, you need to specify `STAFF_MEMBER` as `options.values.type`. Also, specify the [resource](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction.md) GUIDs associated with the relevant staff members as `variants.values.choices.staffMemberId`. You could follow this [sample flow](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/sample-flows.md#create-staff-member-based-service-variants). ### Custom option To create an option based on a custom parameter, specify `CUSTOM` as `options.values.type`. Provide descriptive names for all custom choices as `variants.values.choices.custom`. These names are displayed to customers during the book flow. You could follow this [sample flow](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/sample-flows.md#create-service-variants-based-on-the-booked-equipment). ### Duration option To create an option based on appointment duration, specify `DURATION` as `options.values.type` and set a descriptive name in `options.values.durationData.name`. Also, indicate the appointment length in `minutes` and provide a descriptive `name` for each duration choice in `variants.values.choices.duration`. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: serviceOptionsAndVariants, serviceOptionsAndVariants.serviceId, serviceOptionsAndVariants.options, serviceOptionsAndVariants.variants Method parameters: param name: serviceOptionsAndVariants | type: ServiceOptionsAndVariants | description: The `serviceOptionsAndVariants` object links a [service](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/introduction.md) to its variants. You can use it to offer customers different prices for a service, depending on which choices they book. | required: true - name: serviceId | type: string | description: GUID of the service related to these options and variants. | required: true - name: options | type: ServiceOptions | description: Service options. Note that currently only a single option is supported per service. | required: true - name: values | type: array | description: Values of the service options. Max: 1 service option - ONE-OF: - name: customData | type: CustomServiceOption | description: Details about the custom option. Available only for `CUSTOM` options. - name: name | type: string | description: Name of the service option. For example, `Age group`, `Location`, `Equipment`, or `Time`. - name: choices | type: array | description: Available choices for the service option. For example, `child`, `student`, `adult`, and `senior` for a service option named `Age group`. Each value must be unique. The value's case is ignored, meaning `Child` and `child` are considered to be identical. Currently, only a single choice is supported because a service can have only a single option. Max: 1 choice - name: durationData | type: DurationServiceOption | description: - name: name | type: string | description: Optional name of the duration option. For example, `Short Class`, or `Extended Class`. - name: _id | type: string | description: GUID of the service option. - name: type | type: ServiceOptionType | description: Type of the service option. - enum: - UNKNOWN: There is no information about the option type. - CUSTOM: The service option is based on a custom parameter. For example, age group, booked equipment, or appointment timing. - STAFF_MEMBER: It's a [staff member](https://dev.wix.com/docs/rest/business-solutions/bookings/staff-members/introduction.md) based option. - DURATION: It's a duration-based option. - name: variants | type: ServiceVariants | description: Information about the service's variants. | required: true - name: values | type: array | description: Values of the service variants. - name: choices | type: array | description: Choices for the service option. Currently, only a single choice is supported because a service can have only a single option. Max: 1 choice - ONE-OF: - name: custom | type: string | description: Name of the custom choice. - name: staffMemberId | type: string | description: GUID of the [resource](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction.md) associated with the [staff member](https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/introduction.md) providing the service. - name: duration | type: Duration | description: Information about the option's duration. - name: minutes | type: integer | description: Duration of the service in minutes. Min: `1` minute Max: `44639` minutes (30 days, 23 hours, and 59 minutes) - name: name | type: string | description: Name of the duration option. Default: Human-readable text of `minutes`. For example, `1 hr 30 min`. - name: optionId | type: string | description: GUID of the service option. - name: price | type: Money | description: Information about the service variant's price. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. - name: revision | type: string | description: Revision number, which increments by 1 each time the `serviceOptionsAndVariants` object is updated. To prevent conflicting changes, the current revision must be passed when updating and deleting the `serviceOptionsAndVariants` object. Ignored when creating a `serviceOptionsAndVariants` object. - name: extendedFields | type: ExtendedFields | description: Extensions enabling users to save custom data related to service options and variants. - 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). Return type: PROMISE - name: _id | type: string | description: GUID of the `serviceOptionsAndVariants` object. - name: serviceId | type: string | description: GUID of the service related to these options and variants. - name: options | type: ServiceOptions | description: Service options. Note that currently only a single option is supported per service. - name: values | type: array | description: Values of the service options. Max: 1 service option - ONE-OF: - name: customData | type: CustomServiceOption | description: Details about the custom option. Available only for `CUSTOM` options. - name: name | type: string | description: Name of the service option. For example, `Age group`, `Location`, `Equipment`, or `Time`. - name: choices | type: array | description: Available choices for the service option. For example, `child`, `student`, `adult`, and `senior` for a service option named `Age group`. Each value must be unique. The value's case is ignored, meaning `Child` and `child` are considered to be identical. Currently, only a single choice is supported because a service can have only a single option. Max: 1 choice - name: durationData | type: DurationServiceOption | description: - name: name | type: string | description: Optional name of the duration option. For example, `Short Class`, or `Extended Class`. - name: _id | type: string | description: GUID of the service option. - name: type | type: ServiceOptionType | description: Type of the service option. - enum: - UNKNOWN: There is no information about the option type. - CUSTOM: The service option is based on a custom parameter. For example, age group, booked equipment, or appointment timing. - STAFF_MEMBER: It's a [staff member](https://dev.wix.com/docs/rest/business-solutions/bookings/staff-members/introduction.md) based option. - DURATION: It's a duration-based option. - name: variants | type: ServiceVariants | description: Information about the service's variants. - name: values | type: array | description: Values of the service variants. - name: choices | type: array | description: Choices for the service option. Currently, only a single choice is supported because a service can have only a single option. Max: 1 choice - ONE-OF: - name: custom | type: string | description: Name of the custom choice. - name: staffMemberId | type: string | description: GUID of the [resource](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction.md) associated with the [staff member](https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/introduction.md) providing the service. - name: duration | type: Duration | description: Information about the option's duration. - name: minutes | type: integer | description: Duration of the service in minutes. Min: `1` minute Max: `44639` minutes (30 days, 23 hours, and 59 minutes) - name: name | type: string | description: Name of the duration option. Default: Human-readable text of `minutes`. For example, `1 hr 30 min`. - name: optionId | type: string | description: GUID of the service option. - name: price | type: Money | description: Information about the service variant's price. - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative. - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD). - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative. - name: minPrice | type: Money | description: Price of the cheapest service variant. - name: maxPrice | type: Money | description: Price of the most expensive service variant. - name: revision | type: string | description: Revision number, which increments by 1 each time the `serviceOptionsAndVariants` object is updated. To prevent conflicting changes, the current revision must be passed when updating and deleting the `serviceOptionsAndVariants` object. Ignored when creating a `serviceOptionsAndVariants` object. - name: extendedFields | type: ExtendedFields | description: Extensions enabling users to save custom data related to service options and variants. - 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). Possible Errors: HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_OPTION_DATA | Description: Specifying `customData` isn't supported for the passed `options.values.type`. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_CUSTOM_CHOICES | Description: All custom choices must be specified in the `variants` array. Either add missing variants or remove unnecessary choices. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: IDENTICAL_CHOICES | Description: Remove identical choices from the request. Note that choices aren't case sensitive. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MISSING_STAFF_VARIANTS | Description: All staff members providing the service must have their associated resource GUIDs specified in the `variants` array. Either add missing resource GUIDs to `variants.values.choices.staffMemberId`, or remove them from the service schedule's `scheduleOwnerId`s in the active schedule's `availability.linkedSchedules` array. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNKNOWN_STAFF_IDS | Description: All resource GUIDs passed in `variants.values.choices.staffMemberId` must be connected to the service's schedule, defined as `scheduleOwnerId` in the active schedule's `availability.linkedSchedules` array. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNSUPPORTED_OPTION_TYPE | Description: The specified option type isn't supported for the passed service. Staff member based variants require that the service's schedule has staff members defined as `scheduleOwnerId` in the active schedule's `availability.linkedSchedules` array. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: MULTIPLE_CURRENCIES | Description: Multiple currencies in the `variants` array. All variants must use the same currency. HTTP Code: 400 | Status Code: INVALID_ARGUMENT | Application Code: UNKNOWN_OPTION_IDS | Description: Unknown option GUIDs in the `variants` array. ``` ### Examples ### createServiceOptionsAndVariants ```javascript import { serviceOptionsAndVariants } from '@wix/bookings'; async function createServiceOptionsAndVariants(serviceOptionsAndVariants) { const response = await serviceOptionsAndVariants.createServiceOptionsAndVariants(serviceOptionsAndVariants); }; ``` ### createServiceOptionsAndVariants (with elevated permissions) ```javascript import { serviceOptionsAndVariants } from '@wix/bookings'; import { auth } from '@wix/essentials'; async function myCreateServiceOptionsAndVariantsMethod(serviceOptionsAndVariants) { const elevatedCreateServiceOptionsAndVariants = auth.elevate(serviceOptionsAndVariants.createServiceOptionsAndVariants); const response = await elevatedCreateServiceOptionsAndVariants(serviceOptionsAndVariants); } ``` ### createServiceOptionsAndVariants (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 { serviceOptionsAndVariants } from '@wix/bookings'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { serviceOptionsAndVariants }, // Include the auth strategy and host as relevant }); async function createServiceOptionsAndVariants(serviceOptionsAndVariants) { const response = await myWixClient.serviceOptionsAndVariants.createServiceOptionsAndVariants(serviceOptionsAndVariants); }; ``` ---