> To build or manage a Wix site with an AI agent, follow https://www.wix.com/headless/skill.md
> It builds a new Wix site or puts your own site online, from a prompt, and keeps changing it afterwards. The pages are code in any web technology, and Wix runs the backend.
> It works through the Wix plugin (the Wix MCP and the Wix skills), the Wix CLI or no Wix login, and puts the site live on Wix hosting or on another host.
> Business features include a store, bookings, events and tickets, a restaurant, a blog, forms, members and many more.
> Read the Wix skills online at https://www.wix.com/skills
> 
> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - If a reference page seems to be missing its schema (parameters, return types, or type definitions), append `?schema=true` to its `.md` URL (e.g. `https://dev.wix.com/docs/contexts/contexts/stores/category-info/use-category-info-context.md?schema=true`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

# GetInventoryVariants

# Package: catalogV1

# Namespace: InventoryReadApi

# Method link: https://dev.wix.com/docs/api-reference/business-solutions/stores/catalog-v1/inventory/get-inventory-variants.md

## Permission Scopes:
Read Products: SCOPE.DC-STORES.READ-PRODUCTS

## REST API

### Schema

```
 Method: getInventoryVariants
 Description: 
 URL: https://www.wixapis.com/stores-reader/v2/inventoryItems/{inventoryId}/getVariants
 Method: POST
 Method parameters:
    - ONE-OF: 
     - name: inventoryId | type: string | description: Inventory item GUID.  
     - name: productId | type: string | description: Product GUID.  
   param name: variantIds | type: array<variantIds> | description: Variant GUIDs to query for this inventory item (optional).  
 Return type: GetInventoryVariantsResponse
  - name: inventoryItem | type: InventoryItemV2 | description: Inventory item.  
     - name: id | type: string | description: Inventory item GUID.  
     - name: productId | type: string | description: Product GUID.  | read-only: true 
     - name: trackQuantity | type: boolean | description: Whether quantity is being tracked. This applies to the entire product, not to individual variants. Every call to `UpdateInventoryVariants` must explicitly set this field. If it is omitted, it is treated as `false` and overwrites the product's current tracking setting for ALL variants, not just the ones included in this request's `variants` list.  
     - name: variants | type: array<InventoryVariantV2> | description: Variants associated with this inventory item.  
        - name: variantId | type: string | description: Variant GUID.  
        - name: inStock | type: boolean | description: Whether the product is listed as in stock.  
        - name: quantity | type: integer | description: Quantity currently left in inventory.  | validation: minimum 0, format int32
        - name: availableForPreorder | type: boolean | description: Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level.  | read-only: true 
     - name: lastUpdated | type: string | description: Last updated timestamp.  | read-only: true | validation: format date-time
     - name: numericId | type: number | description: Inventory’s unique numeric GUID (assigned in ascending order). Primarily for sorting and filtering when crawling all inventories.  | read-only: true 
     - name: preorderInfo | type: PreorderInfo | description: Preorder information.  
        - name: enabled | type: boolean | description: Whether the item is available for preorder.  
        - name: message | type: string | description: A message the buyer will see when the item is out of stock and preorder is enabled.  | validation: minLength 1, maxLength 250
        - name: limit | type: integer | description: Number of products that can be preordered after stock reaches zero.  | validation: minimum 0, maximum 100000, format int32


```

### Examples

### GetInventoryVariants
```curl
~~~cURL
curl -X POST https://www.wixapis.com/stores/v2/inventoryItems/be547028-fb08-b962-75e8-3f3e56da9ee3/getVariants \
   -H 'Content-Type: application/json' \
   -H 'Authorization: <AUTH>' \
   --data-binary '{}'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.stores.inventory.getInventoryVariants(inventoryId, options)
 Description: 
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  inventoryId
 Method parameters: 
   param name: inventoryId | type: string | description: Inventory item GUID. | required: true 
   param name: options | type: GetInventoryVariantsOptions  none  
    - ONE-OF: 
     - name: inventoryId | type: string | description: Inventory item GUID.  
     - name: productId | type: string | description: Product GUID.  
        - name: variantIds | type: array<string> | description: Variant GUIDs to query for this inventory item (optional).  
 Return type: PROMISE<GetInventoryVariantsResponse>
  - name: inventoryItem | type: InventoryItemV2 | description: Inventory item.  
     - name: _id | type: string | description: Inventory item GUID.  
     - name: productId | type: string | description: Product GUID.  | read-only: true 
     - name: trackQuantity | type: boolean | description: Whether quantity is being tracked. This applies to the entire product, not to individual variants. Every call to `UpdateInventoryVariants` must explicitly set this field. If it is omitted, it is treated as `false` and overwrites the product's current tracking setting for ALL variants, not just the ones included in this request's `variants` list.  
     - name: variants | type: array<InventoryVariantV2> | description: Variants associated with this inventory item.  
        - name: variantId | type: string | description: Variant GUID.  
        - name: inStock | type: boolean | description: Whether the product is listed as in stock.  
        - name: quantity | type: integer | description: Quantity currently left in inventory.  | validation: minimum 0, format int32
        - name: availableForPreorder | type: boolean | description: Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level.  | read-only: true 
     - name: lastUpdated | type: Date | description: Last updated timestamp.  | read-only: true 
     - name: numericId | type: number | description: Inventory’s unique numeric GUID (assigned in ascending order). Primarily for sorting and filtering when crawling all inventories.  | read-only: true 
     - name: preorderInfo | type: PreorderInfo | description: Preorder information.  
        - name: enabled | type: boolean | description: Whether the item is available for preorder.  
        - name: message | type: string | description: A message the buyer will see when the item is out of stock and preorder is enabled.  | validation: minLength 1, maxLength 250
        - name: limit | type: integer | description: Number of products that can be preordered after stock reaches zero.  | validation: minimum 0, maximum 100000, format int32


```

### Examples

### Get inventory variants
Get inventory variants for a specific inventory item

```javascript
import { inventory } from "@wix/stores";

const inventoryId = "3bc2c93a-3ca5-6e13-e3cc-2d71038f2a59";

async function getInventoryVariants() {
  const response = await inventory.getInventoryVariants(inventoryId);
  return response;
}

const result = await inventory.getInventoryVariants(inventoryId);

/* Promise resolves to:
 * {
 *   "inventoryItem": {
 *     "externalId": "c43d36c5-c35a-91ec-1c33-d28efc70d5a6",
 *     "productId": "c43d36c5-c35a-91ec-1c33-d28efc70d5a6",
 *     "trackQuantity": true,
 *     "variants": [
 *       {
 *         "variantId": "00000000-0000-0000-0000-000000000000",
 *         "inStock": true,
 *         "quantity": 10,
 *         "availableForPreorder": false
 *       }
 *     ],
 *     "numericId": "1766909903931000",
 *     "preorderInfo": {
 *       "enabled": false
 *     },
 *     "_id": "3bc2c93a-3ca5-6e13-e3cc-2d71038f2a59"
 *   }
 * }
 */


```

### Get inventory variants
Get inventory variants for a specific inventory item

```javascript
import { inventory } from "@wix/stores";

const inventoryId = "3bc2c93a-3ca5-6e13-e3cc-2d71038f2a59";

async function getInventoryVariants() {
  const response = await inventory.getInventoryVariants(inventoryId);
  return response;
}

const result = await inventory.getInventoryVariants(inventoryId);

/* Promise resolves to:
 * {
 *   "inventoryItem": {
 *     "externalId": "c43d36c5-c35a-91ec-1c33-d28efc70d5a6",
 *     "productId": "c43d36c5-c35a-91ec-1c33-d28efc70d5a6",
 *     "trackQuantity": true,
 *     "variants": [
 *       {
 *         "variantId": "00000000-0000-0000-0000-000000000000",
 *         "inStock": true,
 *         "quantity": 10,
 *         "availableForPreorder": false
 *       }
 *     ],
 *     "numericId": "1766909903931000",
 *     "preorderInfo": {
 *       "enabled": false
 *     },
 *     "_id": "3bc2c93a-3ca5-6e13-e3cc-2d71038f2a59"
 *   }
 * }
 */


```

### getInventoryVariants (self-managed)
Self-managed SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).

```javascript
import { createClient } from '@wix/sdk';
import { inventory } from '@wix/stores';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

const myWixClient = createClient ({
  modules: { inventory },
  // Include the auth strategy and host as relevant
});


async function getInventoryVariants(inventoryId,options) {
  const response = await myWixClient.inventory.getInventoryVariants(inventoryId,options);
};
```

---