POST

Create Service Options And Variants


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 ID

When creating aserviceOptionsAndVariants object, you must specify an ID in UUID format for its only option. You must reference this option ID for each variant as variants.values.choices.optionId.

Staff member option

To creating an option based on the staff member (SDK | REST) providing the service, you need to specify STAFF_MEMBER as options.values.type. Also, specify all staff member IDs as variants.values.choices.staffMemberId. You could follow this sample flow (SDK | REST).

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 (SDK | REST).

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.

Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Bookings Services and Settings
Manage Bookings - all permissions
Manage Bookings
Learn more about app permissions.
Endpoint
POST
https://www.wixapis.com/bookings/v1/serviceOptionsAndVariants

Body Params
serviceOptionsAndVariantsServiceOptionsAndVariantsRequired

Service options and variants to create.

Response Object
serviceOptionsAndVariantsServiceOptionsAndVariants

Information about the created service options and variants.

Request
cURL
curl -X POST \ 'https://wixapis.com/bookings/v1/serviceOptionsAndVariants' \ -H 'Authorization: <AUTH>' \ -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" } } ] } } }'
Response
JSON
{ "serviceOptionsAndVariants": { "id": "7e7eac53-21c9-41fd-844b-25b287aa38ce", "serviceId": "6072fbad-5c95-4bf6-a9bc-4280aadc1ae8", "options": { "values": [ { "id": "0b78af72-0ba0-4e71-ba39-b4386555a353", "type": "CUSTOM", "customData": { "name": "Customer Type", "choices": ["Student", "Adult"] } } ] }, "variants": { "values": [ { "choices": [ { "optionId": "0b78af72-0ba0-4e71-ba39-b4386555a353", "custom": "Student" } ], "price": { "value": "3", "currency": "EUR" } }, { "choices": [ { "optionId": "0b78af72-0ba0-4e71-ba39-b4386555a353", "custom": "Adult" } ], "price": { "value": "12", "currency": "EUR" } } ] }, "minPrice": { "value": "3", "currency": "EUR" }, "maxPrice": { "value": "12", "currency": "EUR" }, "revision": "1" } }
Errors
400Invalid Argument

There are 8 errors with this status code.

This method may also return standard errors. Learn more about standard Wix errors.

Event TriggersThis method triggers the following events:
Did this help?