Search.../

updateServiceOptionsAndVariants( )

Developer Preview

Updates the specified fields of the serviceOptionsAndVariants object.

Description

Currently, only a single option is supported per serviceOptionsAndVariants object.

If you want to update variants, you must pass the full list of supported variants.

If you want to update options, you must pass the full list of supported options.

For a list of error messages, see Update 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 updateServiceOptionsAndVariants(_id: string, serviceOptionsAndVariants: UpdateServiceOptionsAndVariants): Promise<ServiceOptionsAndVariants>

updateServiceOptionsAndVariants Parameters

NAME
TYPE
DESCRIPTION
_id
string

ID of the serviceOptionsAndVariants object.

serviceOptionsAndVariants
UpdateServiceOptionsAndVariants

Service options and variants to update.

Returns

Updated serviceOptionsAndVariants object.

Return Type:

Promise<
ServiceOptionsAndVariants
>
NAME
TYPE
DESCRIPTION
_id
string

ID of the serviceOptionsAndVariants object.

maxPrice
Money

Price of the most expensive service variant.

minPrice
Money

Price of the cheapest service variant.

options
ServiceOptions

Service options. Note that currently only a single option is supported per service.

revision
string

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.

serviceId
string

ID of the service related to these options and variants.

variants
ServiceVariants

Information about the service's variants.

Was this helpful?

updateServiceOptionsAndVariants example

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