Search.../

getInventoryVariants( )

Developer Preview

Gets inventory variant information based on the specified option choices.

Description

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

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function getInventoryVariants(inventoryId: string, options: GetInventoryVariantsOptions): Promise<GetInventoryVariantsResponse>

getInventoryVariants Parameters

NAME
TYPE
DESCRIPTION
inventoryId
string

Inventory item ID.

options
Optional
GetInventoryVariantsOptions

Returns

Return Type:

Promise<
GetInventoryVariantsResponse
>
NAME
TYPE
DESCRIPTION
inventoryItem
InventoryItemV2

Inventory item.

Was this helpful?

getInventoryVariants example

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