Search...
incrementInventory( )
Adds a set number of items from inventory.
Description
The incrementInventory()
function returns a Promise that is resolved
when the specified item's quantity has been updated in the inventory.
Authorization
Request
This endpoint does not take any parameters
Response Object
Fulfilled - When the inventory is incremented.
Returns an empty object.
Status/Error Codes
Related Content:
Was this helpful?
Increment the inventory of a product's first variant
Copy Code
1/*******************************2 * Backend code - inventory.jsw *3 *******************************/45import wixStoresBackend from 'wix-stores-backend';67export function incrementInventory(incrementInfo) {8 return wixStoresBackend.incrementInventory(incrementInfo);9}1011/**************12 * Page code *13 **************/1415import { incrementInventory } from 'backend/inventory';161718async function incrementHandler() {1920 const productId = "3fb6a3c8-988b-8755-04bd-ks75ae0b18ea"21 let variants = await getProductVariants(productId);2223 incrementInventory(24 [{25 variantId: variants[0]._id,26 productId: productId,27 incrementBy: 128 }])29 .then(() => {30 console.log("Inventory incremented successfully")31 })32 .catch(error => {33 // Inventory increment failed34 console.error(error);35 })36}