> 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`). > - 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: catalogV1 # Namespace: catalog # Webhook link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/catalog/variants-changed.md ## Introduction Triggered when a product variant is changed. --- ## REST API ### Schema ``` Webhook: Variants Changed Description: Triggered when a product variant is changed. Payload: VariantsChanged - name: productId | type: string | description: Product GUID. - name: variants | type: array | description: List of variants that were changed. - name: variantId | type: string | description: Variant GUID. - name: choices | type: object | description: - name: changedFields | type: array | description: List of variant fields that were changed. - name: originatedFromVersion | type: Version | description: Information about the version of the catalog from where this event was triggered. - enum: - V1_CATALOG: Version 1 of the catalog. - V3_CATALOG: Version 3 of the catalog. - STORES_NOT_INSTALLED: Stores app is not installed. - name: originatedFromVersion | type: Version | description: Information about the version of the catalog from where this event was triggered. - enum: - V1_CATALOG: Version 1 of the catalog. - V3_CATALOG: Version 3 of the catalog. - STORES_NOT_INSTALLED: Stores app is not installed. ``` ### Examples ```curl { "productId": "7e4f023f-53d2-70da-30bb-31662b3c095f", "variants": [ { "variantId": "00000000-0000-0002-0005-918e4641acb0", "choices": { "Size": "large" }, "changedFields": ["sku", "price"] }, { "variantId": "00000000-0000-0001-0005-918e4641acb0", "choices": { "Size": "small" }, "changedFields": ["sku", "price"] }, { "variantId": "00000000-0000-0004-0005-918e4641acb0", "choices": { "Size": "mySize" }, "changedFields": ["sku"] } ] } ``` --- ## JavaScript SDK ### Schema ``` Webhook: onProductVariantsChanged Description: Triggered when a product variant is changed. Payload: ProductVariantsChangedEnvelope - name: data | type: VariantsChanged | description: none - name: productId | type: string | description: Product GUID. - name: variants | type: array | description: List of variants that were changed. - name: variantId | type: string | description: Variant GUID. - name: choices | type: object | description: - name: changedFields | type: array | description: List of variant fields that were changed. - name: originatedFromVersion | type: Version | description: Information about the version of the catalog from where this event was triggered. - enum: - V1_CATALOG: Version 1 of the catalog. - V3_CATALOG: Version 3 of the catalog. - STORES_NOT_INSTALLED: Stores app is not installed. - name: originatedFromVersion | type: Version | description: Information about the version of the catalog from where this event was triggered. - enum: - V1_CATALOG: Version 1 of the catalog. - V3_CATALOG: Version 3 of the catalog. - STORES_NOT_INSTALLED: Stores app is not installed. - name: metadata | type: BaseEventMetadata | 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. ``` ### Examples ```javascript import { products } from '@wix/stores'; products.onProductVariantsChanged((event) => { // handle your event here }); ``` ```javascript import { createClient, AppStrategy } from '@wix/sdk'; import { products } from '@wix/stores'; const wixClient = createClient({ auth: AppStrategy({ appId: 'MY-APP-ID', publicKey: 'YOUR_APP_PUBLIC_KEY', }), modules: { products, }, }); wixClient.products.onProductVariantsChanged((event) => { // handle your event here }); ``` ---