updateServiceOptionsAndVariants( )
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.
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 of the serviceOptionsAndVariants
object.
Service options and variants to update.
Returns
Updated serviceOptionsAndVariants
object.
Return Type:
NAME
TYPE
DESCRIPTION
ID of the serviceOptionsAndVariants
object.
Price of the most expensive service variant.
Price of the cheapest service variant.
Service options. Note that currently only a single option is supported per service.
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.
ID of the service related to these options and variants.
Information about the service's variants.
Was this helpful?
updateServiceOptionsAndVariants example
1import { serviceOptionsAndVariants } from 'wix-bookings.v2';23 async function updateServiceOptionsAndVariants(id, serviceOptionsAndVariants, options) {4 try {5 const result = await serviceOptionsAndVariants.updateServiceOptionsAndVariants(id, serviceOptionsAndVariants, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13