> 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: inventory # Webhook link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/inventory/inventory-item-changed.md ## Introduction Triggered when an inventory item is changed. --- ## REST API ### Schema ``` Webhook: Inventory Item Changed Description: Triggered when an inventory item is changed. Payload: InventoryItemChanged - name: inventoryItemId | type: string | description: Inventory item GUID. - name: productId | type: string | description: Product GUID. - name: trackInventory | type: boolean | description: Whether inventory is being tracked. - name: preorderInfo | type: PreorderInfo | description: Preorder information. - name: enabled | type: boolean | description: Whether the item is available for preorder. - name: message | type: string | description: A message the buyer will see when the item is out of stock and preorder is enabled. - name: limit | type: integer | description: Number of products that can be preordered after stock reaches zero. - name: fieldMask | type: | description: Field mask of updated fields. - name: updatedDate | type: string | description: Date and time the inventory item was last updated. ``` ### Examples ```curl { "inventoryItemId": "81b0fdc0-ac2d-8f25-cf44-ce99d4c3f6a0", "externalId": "7e4f023f-53d2-70da-30bb-31662b3c095f", "productId": "7e4f023f-53d2-70da-30bb-31662b3c095f", "trackInventory": false } ``` --- ## JavaScript SDK ### Schema ``` Webhook: onInventoryItemChanged Description: Triggered when an inventory item is changed. Payload: InventoryItemChangedEnvelope - name: data | type: InventoryItemChanged | description: none - name: inventoryItemId | type: string | description: Inventory item GUID. - name: productId | type: string | description: Product GUID. - name: trackInventory | type: boolean | description: Whether inventory is being tracked. - name: preorderInfo | type: PreorderInfo | description: Preorder information. - name: enabled | type: boolean | description: Whether the item is available for preorder. - name: message | type: string | description: A message the buyer will see when the item is out of stock and preorder is enabled. - name: limit | type: integer | description: Number of products that can be preordered after stock reaches zero. - name: fieldMask | type: array | description: Field mask of updated fields. - name: _updatedDate | type: Date | description: Date and time the inventory item was last updated. - 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 { inventory } from '@wix/stores'; inventory.onInventoryItemChanged((event) => { // handle your event here }); ``` ```javascript import { createClient, AppStrategy } from '@wix/sdk'; import { inventory } from '@wix/stores'; const wixClient = createClient({ auth: AppStrategy({ appId: 'MY-APP-ID', publicKey: 'YOUR_APP_PUBLIC_KEY', }), modules: { inventory, }, }); wixClient.inventory.onInventoryItemChanged((event) => { // handle your event here }); ``` ---