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.)
- Item Represents a product from the catalog.
- Variant A product variant. The inventory is managed per variant.
Step 1 - Query product variants (Get Inventory Variants endpoint)
Copy Code
curl '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:
Copy Code
{"inventoryItem": {"id": "f8753103-0b3a-b24a-4931-50de280ac31a","externalId": "078acefc-f4c5-4db5-b6ce-af21d7f53ce5","productId": "078acefc-f4c5-4db5-b6ce-af21d7f53ce5","trackQuantity": true,"variants": [{"variantId": "00000000-0000-0000-0000-000000000000","inStock": true,"quantity": 4}],"lastUpdated": "2020-08-31T20:05:40.348Z","numericId": "1598904314932014"}}
Step 2 - Update a specific variant of a product (Update Inventory Status endpoint)
Update whether the product inventory is tracked:
Copy Code
curl '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:
Copy Code
curl '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:
Copy Code
curl '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:Syntax
Subtracts a set number of items from inventory.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Adds a set number of items to inventory.
Permission Scopes
For app development, you must have one of the following permission scopes:Syntax
Triggered when an inventory item is changed.
Event Body
Triggered when inventory variants are changed.