Creates a serviceOptionsAndVariants
object and for a service.
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.
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.
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
.
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).
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).
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
.
You can only call this method when authenticated as a Wix app or Wix user identity.
function createServiceOptionsAndVariants(
serviceOptionsAndVariants: ServiceOptionsAndVariants,
): Promise<ServiceOptionsAndVariants>;
Service options and variants to create.
import { serviceOptionsAndVariants } from "@wix/bookings";
async function createServiceOptionsAndVariants(serviceOptionsAndVariants) {
const response =
await serviceOptionsAndVariants.createServiceOptionsAndVariants(
serviceOptionsAndVariants,
);
}
There are 8 errors with this status code.
This method may also return standard errors. Learn more about standard Wix errors.