Search.../

cloneServiceOptionsAndVariants( )

Developer Preview

Clones a serviceOptionsAndVariants object. This endpoint can be called, for example, to duplicate a service. The cloned service contains all the original service options and variants.

Description

Each option in the cloned service has a newly-generated ID that is copied to all choices of the variants in the clone. The cloned service references the service provided in the request by target_service_id.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function cloneServiceOptionsAndVariants(cloneFromId: string, targetServiceId: string): Promise<CloneServiceOptionsAndVariantsResponse>

cloneServiceOptionsAndVariants Parameters

NAME
TYPE
DESCRIPTION
cloneFromId
string

ID of the serviceOptionsAndVariants object to clone.

targetServiceId
string

ID of the service that will be set for the cloned serviceOptionsAndVariants

Returns

Return Type:

Promise<
CloneServiceOptionsAndVariantsResponse
>
NAME
TYPE
DESCRIPTION
serviceOptionsAndVariants
ServiceOptionsAndVariants

The cloned serviceOptionsAndVariants object.

Was this helpful?

cloneServiceOptionsAndVariants example

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