createServiceOptionsAndVariants( )
Creates options and variants for a service.
Description
Before creating the serviceOptionsAndVariants
object you need to anticipate and manually define
all variants based on the defined options and their choices. You then pass
the options
and variants
arrays in the
request. Variants aren't automatically calculated from the defined options and choices.
Current Limitations:
Only a single
serviceOptionsAndVariants
object is supported per service.Only a single option is supported per
serviceOptionsAndVariants
object. This means that services are limited to a single option. Therefore,variants
provides pricing details for either all choices of the single option (forCUSTOM
options) or all staff members providing the service (forSTAFF_MEMBER
options).
For a list of error messages, see Create Service Options and Variants Errors.
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function createServiceOptionsAndVariants(serviceOptionsAndVariants: ServiceOptionsAndVariants): Promise<CreateServiceOptionsAndVariantsResponse>
createServiceOptionsAndVariants Parameters
NAME
TYPE
DESCRIPTION
Service options and variants to create.
Returns
Return Type:
NAME
TYPE
DESCRIPTION
Information about the created service options and variants.
Was this helpful?
createServiceOptionsAndVariants example
1import { serviceOptionsAndVariants } from 'wix-bookings.v2';23 async function createServiceOptionsAndVariants(serviceOptionsAndVariants) {4 try {5 const result = await serviceOptionsAndVariants.createServiceOptionsAndVariants(serviceOptionsAndVariants);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13