> 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 # IncrementInventory # Package: catalogV1 # Namespace: InventoryWriteApi # Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/inventory/increment-inventory.md ## Permission Scopes: Manage Products: SCOPE.DC-STORES.MANAGE-PRODUCTS ## Introduction Adds a set number of items to inventory. --- ## REST API ### Schema ``` Method: incrementInventory Description: Adds a set number of items to inventory. URL: https://www.wixapis.com/stores/v2/inventoryItems/increment Method: POST Method parameters: param name: incrementData | type: array - ONE-OF: - name: inventoryId | type: string | description: Inventory item GUID. - name: productId | type: string | description: Product GUID. - name: variantId | type: string | description: Variant GUID. - name: incrementBy | type: integer | description: Number to increment inventory by. Return type: IncrementInventoryResponse EMPTY-OBJECT {} ``` ### Examples ### IncrementInventory ```curl ~~~cURL curl -X POST https://www.wixapis.com/stores/v2/inventoryItems/increment \ -H 'Content-Type: application/json' \ -H 'Authorization: ' \ --data-binary ' { "incrementData": [ { "productId": "f007074f-d7a8-a68b-e6c1-7d7c3de021ff", "variantId": "00000000-0000-0001-0005-9ccb19c4e6f0", "incrementBy": 2 } ] }' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.catalogV1.InventoryWriteApi.incrementInventory(incrementData) Description: Adds a set number of items to inventory. # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present. Required parameters: incrementData Method parameters: param name: incrementData | type: array | required: true - ONE-OF: - name: inventoryId | type: string | description: Inventory item GUID. - name: productId | type: string | description: Product GUID. - name: variantId | type: string | description: Variant GUID. - name: incrementBy | type: integer | description: Number to increment inventory by. Return type: PROMISE EMPTY-OBJECT {} ``` ### Examples ### Increment the inventory of a product's first variant ```javascript /************************************** * Backend code - inventory.web.js/ts * **************************************/ import { Permissions, webMethod } from '@wix/web-methods'; import { inventory, products } from '@wix/stores'; export const incrementInventory = webMethod(Permissions.Anyone, (incrementData) => { return inventory.incrementInventory(incrementData); }); export const getProductVariants = webMethod(Permissions.Anyone, (_id, options) => { return products.getProductVariants(_id, options); }); /************** * Page code * **************/ import { incrementInventory, getProductVariants } from 'backend/inventory.web'; async function incrementHandler() { const productId = "3fb6a3c8-988b-8755-04bd-ks75ae0b18ea" let variants = await getProductVariants(productId); incrementInventory( [{ variantId: variants[0]._id, productId: productId, incrementBy: 1 }]) .then(() => { console.log("Inventory incremented successfully") }) .catch(error => { // Inventory increment failed console.error(error); }) } ``` ### Increment inventory Increase inventory quantity for a product variant ```javascript import { inventory } from "@wix/stores"; const incrementData = [ { productId: "c43d36c5-c35a-91ec-1c33-d28efc70d5a6", variantId: "00000000-0000-0000-0000-000000000000", incrementBy: 2 } ]; async function incrementInventory() { const response = await inventory.incrementInventory(incrementData); return response; } const result = await inventory.incrementInventory(incrementData); ``` ### incrementInventory (self-hosted) Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md). ```javascript import { createClient } from '@wix/sdk'; import { inventory } from '@wix/stores'; // Import the auth strategy for the relevant access type // Import the relevant host module if needed const myWixClient = createClient ({ modules: { inventory }, // Include the auth strategy and host as relevant }); async function incrementInventory(incrementData) { const response = await myWixClient.inventory.incrementInventory(incrementData); }; ``` ---