About the Inventory API
This service allows you to query and modify the inventory for your store's products.
(In the future, this service might be used to manage inventory for other things.)
Terminology
- Item Represents a product from the catalog.
- Variant A product variant. The inventory is managed per variant.
Using the Inventory API
Step 1 - Query product variants (Get Inventory Variants endpoint)
1curl 'https://www.wixapis.com/stores/v2/inventoryItems/product/{productId}/getVariants' -H 'Content-Type: application/json' -H 'Authorization: XXX'
From the result, you can see whether inventory is being tracked for this product:
1{2 "inventoryItem": {3 "id": "f8753103-0b3a-b24a-4931-50de280ac31a",4 "externalId": "078acefc-f4c5-4db5-b6ce-af21d7f53ce5",5 "productId": "078acefc-f4c5-4db5-b6ce-af21d7f53ce5",6 "trackQuantity": true,7 "variants": [8 {9 "variantId": "00000000-0000-0000-0000-000000000000",10 "inStock": true,11 "quantity": 412 }13 ],14 "lastUpdated": "2020-08-31T20:05:40.348Z",15 "numericId": "1598904314932014"16 }17}
Step 2 - Update a specific variant of a product (Update Inventory Status endpoint)
Update whether the product inventory is tracked:
1curl 'https://www.wixapis.com/stores/v2/inventoryItems/product/{productId}' -X PATCH --data-binary '{"inventoryItem": {"trackQuantity": false}}' -H 'Content-Type: application/json' -H 'Authorization: XXX'
For a non-tracked product, you should update inStock:
1curl 'https://www.wixapis.com/stores/v2/inventoryItems/product/{productId}' -X PATCH --data-binary '{"inventoryItem": {"trackQuantity": false,"variants": [{"variantId": "00000000-0000-0000-0000-000000000000","inStock": false}]}}' -H 'Content-Type: application/json' -H 'Authorization: XXX'
For tracked products, you should update quantity:
1curl 'https://www.wixapis.com/stores/v2/inventoryItems/product/{productId}' -X PATCH --data-binary '{"inventoryItem": {"trackQuantity": true,"variants": [{"variantId": "00000000-0000-0000-0000-000000000000","quantity": 4}]}}' -H 'Content-Type: application/json' -H 'Authorization: XXX'
Permission Scopes
For app development, you must have one of the following permission scopes:Returns a list of up inventory items, given the provided paging, sorting and filtering. See Stores Pagination for more information.
Permission Scopes
For app development, you must have one of the following permission scopes:Updates product inventory, including total quantity, whether the product is in stock, and whether the product inventory is tracked.
Permission Scopes
For app development, you must have one of the following permission scopes:This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Subtracts a set number of items from inventory.
Permission Scopes
For app development, you must have one of the following permission scopes:This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Adds a set number of items to inventory.
Permission Scopes
For app development, you must have one of the following permission scopes:Triggered when an inventory item is changed.
Triggered when inventory variants are changed.