Search...
decrementInventory( )
Subtracts a set number of items from inventory.
Description
The decrementInventory()
function returns a Promise that is resolved when the specified item's quantity has been updated in the inventory.
Admin Method
This function requires elevated permissions to run. This function is not universal and runs only on the backend.
Syntax
function decrementInventory(decrementData: Array<DecrementData>): Promise<void>
decrementInventory Parameters
NAME
TYPE
DESCRIPTION
decrementData
Array<
DecrementData
>Item or product to decrement.
Returns
Return Type:
Promise<
void
>Was this helpful?
decrementInventory example
Copy Code
1import { inventory } from 'wix-stores.v2';23 async function decrementInventory(decrementData, options) {4 try {5 const result = await inventory.decrementInventory(decrementData, options);67 return result;8 } catch (error) {9 console.error(error);10 // Handle the error11 }12 }13