> 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

# Package: services

# Namespace: serviceOptionsAndVariants

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

# Webhook Permissions Scopes IDs:
Read Bookings - Public Data: SCOPE.DC-BOOKINGS.READ-BOOKINGS-PUBLIC

## REST API

### Schema

```
Webhook: Service Options And Variants Updated
Description: 
Event body:
 - name: id | type: string | description: Unique event ID. Allows clients to ignore duplicate events.
 - name: entityFqdn | type: string | description: Fully qualified domain name of the entity associated with the event.
 - name: slug | type: string | description: Event name.
 - name: entityId | type: string | description: ID of the entity associated with the event.
 - name: eventTime | type: string (date-time) | description: Event timestamp.
 - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application such as GDPR.
 - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
 - name: updatedEvent | type: object | description: Updated event details.
    - name: currentEntity | type: ServiceOptionsAndVariants | description: The entity after the update.
        - name: id | type: string | description: GUID of the `serviceOptionsAndVariants` object.
        - name: serviceId | type: string | description: GUID of the service related to these options and variants.
        - 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
              - 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`.
                    - 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
                 - name: durationData | type: DurationServiceOption | description: 
                    - name: name | type: string | description: Optional name of the duration option. For example, `Short Class`, or `Extended Class`.
              - name: id | type: string | description: GUID of the service option.
              - 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.
              - 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
                 - ONE-OF:
                    - name: custom | type: string | description: Name of the custom choice.
                    - 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.
                    - 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)
                       - name: name | type: string | description: Name of the duration option.  Default: Human-readable text of `minutes`. For example, `1 hr 30 min`.
                    - 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.
                                       - 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.
                             - 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.
                          - 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
                          - 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.
                             - name: localEndDate | type: string | description: End of the date range in `YYYY-MM-DDThh:mm:ss` format, inclusive. Evaluated in the business time zone.
                             - 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`.
                    - 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`
                       - name: maxParticipants | type: integer | description: Upper bound of the participants range, inclusive.  Min: `1` Max: `999`
                       - name: name | type: string | description: Optional name of the range. For example, `Small group`, or `Large group`.
                    - 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.
                    - 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: 
                             - name: maxDurationInMinutes | type: integer | description: 
                          - name: dayOptions | type: DailyConfig | description: Tier bounds in days. Set when `unit_type` is `DAY`.
                             - name: minDurationInDays | type: integer | description: 
                             - name: maxDurationInDays | type: integer | description: 
                       - name: name | type: string | description: Display name for this tier. For example, `1–3 hours` or `4–7 days`.
                       - 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.
              - 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.
                 - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD).
                 - 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.
        - name: minPrice | type: Money | description: Price of the cheapest service variant.
        - name: maxPrice | type: Money | description: Price of the most expensive service variant.
        - 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.
        - 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).

```

### Examples


```curl
{
  "id": "1c14fdca-9b35-4c09-ae60-d1fc4c00df0f",
  "entityFqdn": "wix.bookings.catalog.v1.service_options_and_variants",
  "slug": "updated",
  "entityId": "1597eb06-dc2e-4f69-a73c-df0bcbbf04bd",
  "updatedEvent": {
    "currentEntity": {
      "id": "1597eb06-dc2e-4f69-a73c-df0bcbbf04bd",
      "serviceId": "7c2609bb-1c22-4231-b80a-eb6dceada32f",
      "options": {
        "values": [
          {
            "id": "85ad3b32-e324-4af1-95d6-746f2a8a4019",
            "type": "CUSTOM",
            "customData": {
              "name": "Client Type",
              "choices": ["Adult", "Child", "Student"]
            }
          }
        ]
      },
      "variants": {
        "values": [
          {
            "choices": [
              {
                "optionId": "85ad3b32-e324-4af1-95d6-746f2a8a4019",
                "custom": "Adult"
              }
            ],
            "price": { "value": "15", "currency": "EUR" }
          },
          {
            "choices": [
              {
                "optionId": "85ad3b32-e324-4af1-95d6-746f2a8a4019",
                "custom": "Child"
              }
            ],
            "price": { "value": "5", "currency": "EUR" }
          },
          {
            "choices": [
              {
                "optionId": "85ad3b32-e324-4af1-95d6-746f2a8a4019",
                "custom": "Student"
              }
            ],
            "price": { "value": "10", "currency": "EUR" }
          }
        ]
      },
      "minPrice": { "value": "5", "currency": "EUR" },
      "maxPrice": { "value": "15", "currency": "EUR" },
      "revision": "2"
    }
  },
  "eventTime": "2022-09-08T10:48:17.575396Z",
  "triggeredByAnonymizeRequest": false
}

```

---

## JavaScript SDK

### Schema

```
Webhook: onServiceOptionsAndVariantsUpdated
Description: 
Payload: ServiceOptionsAndVariantsUpdatedEnvelope
  - name: entity | type: ServiceOptionsAndVariants | description: none
     - name: _id | type: string | description: GUID of the `serviceOptionsAndVariants` object.
     - name: serviceId | type: string | description: GUID of the service related to these options and variants.
     - 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
           - 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`.
                 - 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
              - name: durationData | type: DurationServiceOption | description: 
                 - name: name | type: string | description: Optional name of the duration option. For example, `Short Class`, or `Extended Class`.
           - name: _id | type: string | description: GUID of the service option.
           - 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.
           - 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
              - ONE-OF:
                 - name: custom | type: string | description: Name of the custom choice.
                 - 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.
                 - 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)
                    - name: name | type: string | description: Name of the duration option.  Default: Human-readable text of `minutes`. For example, `1 hr 30 min`.
                 - 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.
                                     - 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.
                          - 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.
                       - 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
                       - 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.
                          - name: localEndDate | type: string | description: End of the date range in `YYYY-MM-DDThh:mm:ss` format, inclusive. Evaluated in the business time zone.
                          - 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`.
                 - 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`
                    - name: maxParticipants | type: integer | description: Upper bound of the participants range, inclusive.  Min: `1` Max: `999`
                    - name: name | type: string | description: Optional name of the range. For example, `Small group`, or `Large group`.
                 - 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.
                 - 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: 
                          - name: maxDurationInMinutes | type: integer | description: 
                       - name: dayOptions | type: DailyConfig | description: Tier bounds in days. Set when `unit_type` is `DAY`.
                          - name: minDurationInDays | type: integer | description: 
                          - name: maxDurationInDays | type: integer | description: 
                    - name: name | type: string | description: Display name for this tier. For example, `1–3 hours` or `4–7 days`.
                    - 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.
           - 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.
              - name: currency | type: string | description: Currency code. Must be valid ISO 4217 currency code (e.g., USD).
              - 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.
     - name: minPrice | type: Money | description: Price of the cheapest service variant.
     - name: maxPrice | type: Money | description: Price of the most expensive service variant.
     - 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.
     - 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).
  - name: metadata | type: EventMetadata | description: none
     - name: instanceId | type: string | description: App instance GUID.
     - name: eventType | type: string | description: Event type.
     - name: identity | type: IdentificationData | description: The identification type and identity data.
        - ONE-OF:
           - name: anonymousVisitorId | type: string | description: GUID of a site visitor that has not logged in to the site.
           - name: memberId | type: string | description: GUID of a site visitor that has logged in to the site.
           - name: wixUserId | type: string | description: GUID of a Wix user (site owner, contributor, etc.).
           - name: appId | type: string | description: GUID of an app.
        - name: identityType | type: WebhookIdentityType | description: 
             - enum: UNKNOWN, ANONYMOUS_VISITOR, MEMBER, WIX_USER, APP
     - name: accountInfo | type: AccountInfo | description: Details related to the account
        - name: accountId | type: string | description: GUID of the Wix account associated with the event.
        - name: parentAccountId | type: string | description: GUID of the parent Wix account. Only included when accountId belongs to a child account.
        - name: siteId | type: string | description: GUID of the Wix site associated with the event. Only included when the event is tied to a specific site.
     - name: _id | type: string | description: Event GUID. With this GUID you can easily spot duplicated events and ignore them.
     - name: entityFqdn | type: string | description: Fully Qualified Domain Name of an entity. This is a unique identifier assigned to the API main business entities. For example, `wix.stores.catalog.product`, `wix.bookings.session`, `wix.payments.transaction`.
     - name: slug | type: string | description: Event action name, placed at the top level to make it easier for users to dispatch messages. For example: `created`/`updated`/`deleted`/`started`/`completed`/`email_opened`.
     - name: entityId | type: string | description: GUID of the entity associated with the event.
     - name: eventTime | type: Date | description: Event timestamp in [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) format and UTC time. For example, `2020-04-26T13:57:50.699Z`.
     - name: triggeredByAnonymizeRequest | type: boolean | description: Whether the event was triggered as a result of a privacy regulation application (for example, GDPR).
     - name: originatedFrom | type: string | description: If present, indicates the action that triggered the event.
     - name: entityEventSequence | type: string | description: A sequence number that indicates the order of updates to an entity. For example, if an entity was updated at `16:00` and then again at `16:01`, the second update will always have a higher sequence number. You can use this number to make sure you're handling updates in the right order. Just save the latest sequence number on your end and compare it to the one in each new message. If the new message has an older (lower) number, you can safely ignore it.

```

### Examples


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

serviceOptionsAndVariants.onServiceOptionsAndVariantsUpdated((event) => {
    // handle your event here
});
```


```javascript
import { createClient, AppStrategy } from '@wix/sdk';
import { serviceOptionsAndVariants } from '@wix/bookings';

const wixClient = createClient({
  auth: AppStrategy({
    appId: 'MY-APP-ID',
    publicKey: 'YOUR_APP_PUBLIC_KEY',
  }),
  modules: {
      serviceOptionsAndVariants,
    },
});

wixClient.serviceOptionsAndVariants.onServiceOptionsAndVariantsUpdated((event) => {
    // handle your event here
});
```

---