cloneServiceOptionsAndVariants( )


Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

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

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.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Bookings Services and Settings
Manage Bookings
Manage Bookings - all permissions
Learn more about app permissions.
Method Declaration
Copy
function cloneServiceOptionsAndVariants(
  cloneFromId: string,
  targetServiceId: string,
): Promise<CloneServiceOptionsAndVariantsResponse>;
Method Parameters
cloneFromIdstringRequired

ID of the serviceOptionsAndVariants object to clone.


targetServiceIdstringRequired

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

Returns
Return Type:Promise<CloneServiceOptionsAndVariantsResponse>
JavaScript
import { serviceOptionsAndVariants } from "wix-bookings.v2"; async function cloneServiceOptionsAndVariants(cloneFromId, targetServiceId) { try { const result = await serviceOptionsAndVariants.cloneServiceOptionsAndVariants( cloneFromId, targetServiceId, ); return result; } catch (error) { console.error(error); // Handle the error } }
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?