> 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 ## Resource: Using the Inventory API ## Article: Using the Inventory API ## Article Link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/inventory/using-the-inventory-api.md ## Article Content: # Using the Inventory API ## Step 1 - Call [Get Inventory Variants](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/inventory/get-inventory-variants.md) to retrieve product variants ::::tabs :::REST_TAB ```curl curl -X POST https://www.wixapis.com/stores/v2/inventoryItems/be547028-fb08-b962-75e8-3f3e56da9ee3/getVariants \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ ``` ::: :::SDK_TAB ```js import { inventory } from "@wix/stores"; const inventoryId = "be547028-fb08-b962-75e8-3f3e56da9ee3" async function getInventoryVariants(inventoryId) { const response = await inventory.getInventoryVariants(inventoryId); } ``` ::: :::: From the result, you can see whether inventory is being tracked for this product: ```json { "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 - Call [Update Inventory Status](https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/inventory/update-inventory-variants.md) to update specific variant of a product Update whether the product inventory is tracked: ::::tabs :::REST_TAB ```curl curl -X PATCH https://www.wixapis.com/stores/v2/inventoryItems/078acefc-f4c5-4db5-b6ce-af21d7f53ce5 \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d ' { "inventoryItem": { "trackQuantity": false, } }' ``` ::: :::SDK_TAB ```js import { inventory } from "@wix/stores"; const productId = "078acefc-f4c5-4db5-b6ce-af21d7f53ce5"; const inventoryItem = { trackQuantity: false } async function updateInventoryVariants(productId, inventoryItem) { const response = await inventory.updateInventoryVariants( productId, inventoryItem ); } ``` ::: :::: For a non-tracked product, you should update the `inStock` value: ::::tabs :::REST_TAB ```curl curl -X PATCH https://www.wixapis.com/stores/v2/inventoryItems/078acefc-f4c5-4db5-b6ce-af21d7f53ce5 \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d ' { "inventoryItem": { "trackQuantity": false, "variants": [ { "variantId": "00000000-0000-0001-0005-9a596c8e6f10", "inStock": false } ] } }' ``` ::: :::SDK_TAB ```js import { inventory } from "@wix/stores"; const productId = "078acefc-f4c5-4db5-b6ce-af21d7f53ce5"; const inventoryItem = { trackQuantity: false, variants: [ { variantId: "00000000-0000-0001-0005-9a596c8e6f10", inStock: false } ] } async function updateInventoryVariants(productId, inventoryItem) { const response = await inventory.updateInventoryVariants( productId, inventoryItem ); } ``` ::: :::: For tracked products, you should update quantity: ::::tabs :::REST_TAB ```curl curl -X PATCH https://www.wixapis.com/stores/v2/inventoryItems/078acefc-f4c5-4db5-b6ce-af21d7f53ce5 \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ -d ' { "inventoryItem": { "trackQuantity": false, "variants": [ { "variantId": "00000000-0000-0001-0005-9a596c8e6f10", "quantity": 4 } ] } }' ``` ::: :::SDK_TAB ```js import { inventory } from "@wix/stores"; const productId = "078acefc-f4c5-4db5-b6ce-af21d7f53ce5"; const inventoryItem = { trackQuantity: false, variants: [ { variantId: "00000000-0000-0001-0005-9a596c8e6f10", quantity: 4 } ] } async function updateInventoryVariants(productId, inventoryItem) { const response = await inventory.updateInventoryVariants( productId, inventoryItem ); } ``` ::: ::::