Introduction

 

Developer Preview
APIs in Developer Preview are subject to change and are not intended for use in production.
Send us your suggestions for improving this API. Your feedback is valuable to us.

 

This service allows you to query and modify the inventory for your store's products.

Terminology

  • Item: a product from the catalog.
  • Variant: a product variant. The inventory is managed per variant.

A variant can override the following values from the parent product:

  • Price
  • SKU
  • Weight
  • Inventory
Was this helpful?
Yes
No

Setup

To use the Inventory API, install the @wix/stores package using npm or Yarn:

Copy
1
npm install @wix/stores

or

Copy
1
yarn add @wix/stores

Then import { inventory } from @wix/stores:

Copy
1
import { inventory } from '@wix/stores'
Was this helpful?
Yes
No

decrementInventory( )

Subtracts a set number of items from inventory.

The decrementInventory() function returns a Promise that is resolved when the specified item's quantity has been updated in the inventory.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Manage Products
Learn more about permission scopes.
Copy
function decrementInventory(decrementData: Array<DecrementData>): Promise<void>
Method Parameters
decrementDataArray<DecrementData>Required

Item or product to decrement.

Was this helpful?
Yes
No

getInventoryVariants( )

Gets inventory variant information based on the specified option choices.

The getInventoryVariants() function returns a Promise that resolves to the specified inventory variant information.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Manage Products
Read Stores - all read permissions
Read Products
Learn more about permission scopes.
Copy
function getInventoryVariants(inventoryId: string, options: GetInventoryVariantsOptions): Promise<GetInventoryVariantsResponse>
Method Parameters
inventoryIdstringRequired

Inventory item ID.


optionsGetInventoryVariantsOptions
Returns
Return Type:Promise<GetInventoryVariantsResponse>
Was this helpful?
Yes
No

incrementInventory( )

Adds a set number of items to inventory.

The incrementInventory() function returns a Promise that is resolved when the specified item's quantity has been updated in the inventory.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Manage Products
Learn more about permission scopes.
Copy
function incrementInventory(incrementData: Array<IncrementData>): Promise<void>
Method Parameters
incrementDataArray<IncrementData>Required

Item or product to increment.

Was this helpful?
Yes
No

queryInventory( )

Developer Preview

This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.

Returns a list of inventory items, given the provided paging, sorting and filtering.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Manage Products
Read Stores - all read permissions
Read Products
Learn more about permission scopes.
Copy
function queryInventory(options: QueryInventoryOptions): Promise<QueryInventoryResponse>
Method Parameters
optionsQueryInventoryOptions
Returns
Return Type:Promise<QueryInventoryResponse>
Was this helpful?
Yes
No

updateInventoryVariants( )

Updates product inventory, including total quantity, whether the product is in stock, and whether the product inventory is tracked.

The updateInventoryVariants() function is a Promise that resolves to the updated inventory variant data.

Permission Scopes

For app development, you must have one of the following permission scopes:
Manage Stores - all permissions
Manage Products
Learn more about permission scopes.
Copy
function updateInventoryVariants(productId: string, inventoryItem: UpdateInventoryVariantsInventoryItem): Promise<void>
Method Parameters
productIdstringRequired

Product ID.


inventoryItemUpdateInventoryVariantsInventoryItemRequired

Inventory item to update.

Was this helpful?
Yes
No