Search.../

createServiceOptionsAndVariants( )

Developer Preview

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, variantsprovides pricing details for either all choices of the single option (for CUSTOM options) or all staff members providing the service (for STAFF_MEMBER options).

For a list of error messages, see Create Service Options and Variants Errors.

Admin Method

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
serviceOptionsAndVariants
ServiceOptionsAndVariants

Service options and variants to create.

Returns

Return Type:

Promise<
CreateServiceOptionsAndVariantsResponse
>
NAME
TYPE
DESCRIPTION
serviceOptionsAndVariants
ServiceOptionsAndVariants

Information about the created service options and variants.

Was this helpful?

createServiceOptionsAndVariants example

Copy Code
1import { serviceOptionsAndVariants } from 'wix-bookings.v2';
2
3 async function createServiceOptionsAndVariants(serviceOptionsAndVariants) {
4 try {
5 const result = await serviceOptionsAndVariants.createServiceOptionsAndVariants(serviceOptionsAndVariants);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13