Search.../

incrementInventory( )

Adds a set number of items to inventory.

Description

The incrementInventory() 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 incrementInventory(incrementData: Array<IncrementData>): Promise<void>

incrementInventory Parameters

NAME
TYPE
DESCRIPTION
incrementData
Array<
IncrementData
>

Item or product to increment.

Returns

Return Type:

Promise<
void
>

Was this helpful?

incrementInventory example

Copy Code
1import { inventory } from 'wix-stores.v2';
2
3 async function incrementInventory(incrementData, options) {
4 try {
5 const result = await inventory.incrementInventory(incrementData, options);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13