> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# cloneServiceOptionsAndVariants

# Package: @wix/bookings

# Namespace: serviceOptionsAndVariants

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/service-options-and-variants/clone-service-options-and-variants.md

## Permission Scopes:
Manage Bookings: SCOPE.DC-BOOKINGS.MANAGE-BOOKINGS

## Introduction

Clones a `serviceOptionsAndVariants` object and connects it to a [service](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md).


The call fails if the service already has a connected
`serviceOptionsAndVariants` object.

The cloned `serviceOptionsAndVariants` object gets a new, unique option ID.
The option ID of the existing `serviceOptionsAndVariants` object isn't reused.

For example, you may call this method after [cloning a service](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/clone-service.md).

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.bookings.serviceOptionsAndVariants.cloneServiceOptionsAndVariants(cloneFromId, targetServiceId)
 Description: Clones a `serviceOptionsAndVariants` object and connects it to a [service](https://dev.wix.com/docs/rest/business-solutions/bookings/services/services-v2/introduction.md).   The call fails if the service already has a connected `serviceOptionsAndVariants` object.  The cloned `serviceOptionsAndVariants` object gets a new, unique option GUID. The option GUID of the existing `serviceOptionsAndVariants` object isn't reused.  For example, you may call this method after [cloning a service](https://dev.wix.com/docs/api-reference/business-solutions/bookings/services/services-v2/clone-service.md).
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  cloneFromId, targetServiceId
 Method parameters: 
   param name: cloneFromId | type: string | description: GUID of the `serviceOptionsAndVariants` object to clone. | required: true | validation: format GUID
   param name: targetServiceId | type: string | description: GUID of the service to which the cloned `serviceOptionsAndVariants` are connected. | required: true | validation: format GUID
 Return type: PROMISE<CloneServiceOptionsAndVariantsResponse>
  - name: serviceOptionsAndVariants | type: ServiceOptionsAndVariants | description: Cloned `serviceOptionsAndVariants` object.  
     - name: _id | type: string | description: GUID of the `serviceOptionsAndVariants` object.  | read-only: true | validation: format GUID
     - name: serviceId | type: string | description: GUID of the service related to these options and variants.  | validation: format GUID, immutable
     - name: options | type: ServiceOptions | description: Service options. Note that currently only a single option is supported per service.  
        - name: values | type: array<ServiceOption> | description: Values of the service options.  Max: 1 service option  | validation: minItems 1, maxItems 1
           - ONE-OF: 
              - name: customData | type: CustomServiceOption | description: Details about the custom option. Available only for `CUSTOM` options.  
                 - name: name | type: string | description: Name of the service option. For example, `Age group`, `Location`, `Equipment`, or `Time`.  | validation: maxLength 255
                 - name: choices | type: array<string> | description: Available choices for the service option. For example, `child`, `student`, `adult`, and `senior` for a service option named `Age group`. Each value must be unique. The value's case is ignored, meaning `Child` and `child` are considered to be identical. Currently, only a single choice is supported because a service can have only a single option.  Max: 1 choice  | validation: maxItems 100, maxLength 255
              - name: durationData | type: DurationServiceOption | description:   
                 - name: name | type: string | description: Optional name of the duration option. For example, `Short Class`, or `Extended Class`.  | validation: maxLength 255
           - name: _id | type: string | description: GUID of the service option.  | validation: format GUID
           - name: type | type: ServiceOptionType | description: Type of the service option.  
                 - enum:
                 -     UNKNOWN: There is no information about the option type.
                 -     CUSTOM: The service option is based on a custom parameter. For example, age group, booked equipment, or appointment timing.
                 -     STAFF_MEMBER: It's a [staff member](https://dev.wix.com/docs/rest/business-solutions/bookings/staff-members/introduction.md) based option.
                 -     DURATION: It's a duration-based option.
                 -     DATE_TIME: The price is resolved from rules based on when the service is booked (days and hours, months, or a date range).
                 -     NUMBER_OF_PARTICIPANTS: The price is resolved from rules based on the number of participants.
                 -     LOCATION: The price is resolved by the business location the service is booked at.
                 -     DURATION_RANGE: The price is resolved from pricing tiers based on the booking duration range.
     - name: variants | type: ServiceVariants | description: Information about the service's variants.  
        - name: values | type: array<ServiceVariant> | description: Values of the service variants.  | validation: minItems 1, maxItems 100
           - name: choices | type: array<ServiceChoice> | description: Choices for the service option. Currently, only a single choice is supported because a service can have only a single option.  Max: 1 choice  | validation: minItems 1, maxItems 1
              - ONE-OF: 
                 - name: custom | type: string | description: Name of the custom choice.  | validation: maxLength 255
                 - name: staffMemberId | type: string | description: GUID of the [resource](https://dev.wix.com/docs/api-reference/business-solutions/bookings/resources/resources-v2/introduction.md) associated with the [staff member](https://dev.wix.com/docs/api-reference/business-solutions/bookings/staff-members/introduction.md) providing the service.  | validation: format GUID
                 - name: duration | type: Duration | description: Information about the option's duration.  
                    - name: minutes | type: integer | description: Duration of the service in minutes.  Min: `1` minute Max: `44639` minutes (30 days, 23 hours, and 59 minutes)  | validation: minimum 1, maximum 44639
                    - name: name | type: string | description: Name of the duration option.  Default: Human-readable text of `minutes`. For example, `1 hr 30 min`.  | validation: maxLength 255
                 - name: dateTime | type: DateTimeRule | description: A rule resolving the price by when the service is booked. Available only for `DATE_TIME` options.  
                    - ONE-OF: 
                       - name: hoursAndDaysRule | type: HoursAndDaysRule | description: Matches when the booked slot falls on one of the given days within the time window.  
                          - name: days | type: array<Day> | description: Days the rule applies to. The time window is evaluated in the business time zone.  | validation: minItems 1, maxItems 7
                                     - enum: MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY
                          - name: startTime | type: string | description: Start of the time window in `HH:mm` format, inclusive. Evaluated in the business time zone.  | validation: format LOCAL_TIME
                          - name: endTime | type: string | description: End of the time window in `HH:mm` format, exclusive. When earlier than `start_time` the window wraps past midnight.  | validation: format LOCAL_TIME
                       - name: monthsRule | type: MonthsRule | description: Matches when the booked slot falls in one of the given months.  
                          - name: months | type: array<integer> | description: Months the rule applies to, as numbers `1`-`12`. Each value must be unique.  Min: 1 month Max: 12 months  | validation: minimum 1, maximum 12, minItems 1, maxItems 12
                       - name: dateRangeRule | type: DateRangeRule | description: Matches when the booked slot falls within the date range.  
                          - name: localStartDate | type: string | description: Start of the date range in `YYYY-MM-DDThh:mm:ss` format, inclusive. Evaluated in the business time zone.  | validation: format LOCAL_DATE_TIME
                          - name: localEndDate | type: string | description: End of the date range in `YYYY-MM-DDThh:mm:ss` format, inclusive. Evaluated in the business time zone.  | validation: format LOCAL_DATE_TIME
                          - name: repeatsAnnually | type: boolean | description: Whether the date range repeats every year on the same month and day. The range dates define both the window (month and day) and the first occurrence.  Changing this field from `true` to `false` pins the range to the current year: `local_start_date` and `local_end_date` then apply to a single concrete year instead of repeating annually.  
                    - name: ruleType | type: DateTimeRuleType | description: Which kind of rule this is. Must match the populated `rule` case.  
                             - enum: HOURS_AND_DAYS, MONTHS, DATE_RANGE
                    - name: name | type: string | description: Optional name of the rule. For example, `Weekend mornings`, or `Holiday season`.  | validation: maxLength 255
                 - name: participantRange | type: ParticipantsRange | description: A rule resolving the price by the number of participants. Available only for `NUMBER_OF_PARTICIPANTS` options.  
                    - name: minParticipants | type: integer | description: Lower bound of the participants range, inclusive.  Min: `1` Max: `999`  | validation: minimum 1, maximum 999, format int32
                    - name: maxParticipants | type: integer | description: Upper bound of the participants range, inclusive.  Min: `1` Max: `999`  | validation: minimum 1, maximum 999, format int32
                    - name: name | type: string | description: Optional name of the range. For example, `Small group`, or `Large group`.  | validation: maxLength 255
                 - name: businessLocationId | type: string | description: GUID of the business location the price applies to.  Limited to business locations. Custom and customer locations aren't supported. Available only for `LOCATION` options.  | validation: format GUID
                 - name: durationRange | type: DurationRange | description: A duration range tier resolving the price by how long the booking is. Available only for `DURATION_RANGE` options.  
                    - ONE-OF: 
                       - name: hourOptions | type: HourlyConfig | description: Tier bounds in minutes. Set when `unit_type` is `HOUR`.  
                          - name: minDurationInMinutes | type: integer | description:   | validation: minimum 30, maximum 1440
                          - name: maxDurationInMinutes | type: integer | description:   | validation: minimum 30, maximum 1440
                       - name: dayOptions | type: DailyConfig | description: Tier bounds in days. Set when `unit_type` is `DAY`.  
                          - name: minDurationInDays | type: integer | description:   | validation: minimum 1, maximum 40
                          - name: maxDurationInDays | type: integer | description:   | validation: minimum 1, maximum 40
                    - name: name | type: string | description: Display name for this tier. For example, `1–3 hours` or `4–7 days`.  | validation: maxLength 255
                    - name: unitType | type: DurationUnitType | description: Unit type for this tier.  
                             - enum:
                             -     HOUR: Duration is expressed in minutes (hourly services).
                             -     DAY: Duration is expressed in days (daily services).
              - name: optionId | type: string | description: GUID of the service option.  | validation: format GUID
           - name: price | type: Money | description: Information about the service variant's price.  
              - name: value | type: string | description: Monetary amount. Decimal string with a period as a decimal separator (e.g., 3.99). Optionally, a single (-), to indicate that the amount is negative.  | validation: format DECIMAL_VALUE, decimalValue {"gte":"0","maxScale":2}
              - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD).  | validation: format CURRENCY
              - name: formattedValue | type: string | description: Monetary amount. Decimal string in local format (e.g., 1 000,30). Optionally, a single (-), to indicate that the amount is negative.  | validation: maxLength 50
     - name: minPrice | type: Money | description: Price of the cheapest service variant.  | read-only: true 
     - name: maxPrice | type: Money | description: Price of the most expensive service variant.  | read-only: true 
     - name: revision | type: string | description: 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.  | validation: format int64, immutable
     - name: extendedFields | type: ExtendedFields | description: Extensions enabling users to save custom data related to service options and variants.  
        - name: namespaces | type: object | description: Extended field data. Each key corresponds to the namespace of the app that created the extended fields. The value of each key is structured according to the schema defined when the extended fields were configured.  You can only access fields for which you have the appropriate permissions.  Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields.md).  | validation: format map


```

### Examples

### cloneServiceOptionsAndVariants
```javascript
import { serviceOptionsAndVariants } from '@wix/bookings';

async function cloneServiceOptionsAndVariants(cloneFromId,targetServiceId) {
  const response = await serviceOptionsAndVariants.cloneServiceOptionsAndVariants(cloneFromId,targetServiceId);
};
```

### cloneServiceOptionsAndVariants (with elevated permissions)
```javascript
import { serviceOptionsAndVariants } from '@wix/bookings';
import { auth } from '@wix/essentials';

async function myCloneServiceOptionsAndVariantsMethod(cloneFromId,targetServiceId) {
  const elevatedCloneServiceOptionsAndVariants = auth.elevate(serviceOptionsAndVariants.cloneServiceOptionsAndVariants);
  const response = await elevatedCloneServiceOptionsAndVariants(cloneFromId,targetServiceId);
}
```

### cloneServiceOptionsAndVariants (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { serviceOptionsAndVariants } from '@wix/bookings';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { serviceOptionsAndVariants },
  // Include the auth strategy and host as relevant
});


async function cloneServiceOptionsAndVariants(cloneFromId,targetServiceId) {
  const response = await myWixClient.serviceOptionsAndVariants.cloneServiceOptionsAndVariants(cloneFromId,targetServiceId);
};
```

---