> 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

# QueryStoreVariants

# Package: catalogV1

# Namespace: CatalogReadApi

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

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

## Introduction

Retrieves up to 100 store variants, given the provided paging, filtering, and sorting.

---

## REST API

### Schema

```
 Method: queryStoreVariants
 Description: Retrieves up to 100 store variants, given the provided paging, filtering, and sorting.
 URL: https://www.wixapis.com/stores-reader/v1/variants/query
 Method: POST
 Method parameters:
   param name: query | type: PlatformQuery    
     - name: paging | type: PlatformPaging | description: Pointer to page of results using offset. Cannot be used together with `cursorPaging`.  
        - name: limit | type: integer | description: Number of items to load.  | validation: minimum 0, maximum 100, format int32
        - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0, format int32
        - name: filter | type: object | description: Filter object.  
        - name: sort | type: array<Sorting> | description: Sorting options. For example, `[{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]`.  
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
           - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
              - name: latitude | type: number | description: Address latitude.  | validation: format double
              - name: longitude | type: number | description: Address longitude.  | validation: format double
 Return type: QueryStoreVariantsResponse
  - name: variants | type: array<StoreVariant> | description: List of variants based on the specified filters and sorting.  
     - name: id | type: string | description: Store variant GUID. Comprised of the `productId` and the `variantId`, separated by a hyphen: {productId}.{variantId}.  
     - name: variantId | type: string | description: Variant GUID.  | validation: format GUID
     - name: productId | type: string | description: Product GUID.  
     - name: variantName | type: string | description: Variant name.  | validation: minLength 1, maxLength 80
     - name: productName | type: string | description: Product name.  | validation: minLength 1, maxLength 80
     - name: managedVariant | type: boolean | description: Whether the variant is managed or represents a product.  
     - name: sku | type: string | description: Variant SKU (stock keeping unit).  | validation: maxLength 40
     - name: stock | type: VariantStock | description: Variant inventory status.  
        - name: trackQuantity | type: boolean | description: Whether inventory is being tracked.  
        - name: quantity | type: integer | description: Quantity currently left in inventory.  | validation: minimum 0, maximum 99999, format int32
        - name: inStock | type: boolean | description: Whether the product is currently in stock (relevant only when tracking manually).  
     - name: choices | type: object | description: The selected options of this variant. For example, `{"Color": "Blue", "Size": "Large"}`.  | validation: format map
     - name: collectionIds | type: array<string> | description: Collections that include this variant.  | validation: format GUID
     - name: media | type: PlatformMedia | description: Media items (images, videos) associated with this variant.  | read-only: true 
        - ONE-OF: 
           - name: image | type: Image | description:   
              - name: id | type: string | description: WixMedia image GUID.  
              - name: url | type: string | description: Image URL.  
              - name: height | type: integer | description: Original image height.  | read-only: true 
              - name: width | type: integer | description: Original image width.  | read-only: true 
              - name: altText | type: string | description: Image alt text.  
              - name: filename | type: string | description: Image filename.  | read-only: true 
           - name: video | type: VideoV2 | description:   
              - name: id | type: string | description: WixMedia GUID.  
              - name: resolutions | type: array<VideoResolution> | description: Available resolutions for the video, starting with the optimal resolution.  | read-only: true | validation: maxItems 100
                 - name: url | type: string | description: Video URL.  
                 - name: height | type: integer | description: Video height.  
                 - name: width | type: integer | description: Video width.  
                 - name: format | type: string | description: Video format for example, mp4, hls.  
              - name: filename | type: string | description: Video filename.  | 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
  - name: metadata | type: PlatformPagingMetadata | description: Details on the paged set of results returned.  
     - name: count | type: integer | description: The number of items returned in this response.  | validation: format int32
     - name: offset | type: integer | description: The offset which was requested. Returned if offset paging was used.  | validation: format int32
     - name: total | type: integer | description: The total number of items that match the query. Returned if offset paging was used.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursors to navigate through result pages. Returned if cursor paging was used.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000


```

### Examples

### QueryStoreVariants
```curl
~~~cURL
curl -X POST \
   'https://www.wixapis.com/stores-reader/v1/variants/query' \
   -H 'Content-Type: application/json' \
   -H 'Authorization: <AUTH>'
~~~
```

---

## JavaScript SDK

### Schema

```
 Method: wixClientAdmin.stores.products.queryStoreVariants(query)
 Description: Retrieves up to 100 store variants, given the provided paging, filtering, and sorting.
 # Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
 Required parameters:  query
 Method parameters: 
   param name: query | type: PlatformQuery   | required: true 
    - ONE-OF: - required: true
     - name: paging | type: PlatformPaging | description: Pointer to page of results using offset. Cannot be used together with `cursorPaging`.  
        - name: limit | type: integer | description: Number of items to load.  | validation: minimum 0, maximum 100, format int32
        - name: offset | type: integer | description: Number of items to skip in the current sort order.  | validation: minimum 0, format int32
     - name: cursorPaging | type: CursorPaging | description: Cursor pointing to page of results. Cannot be used together with `paging`. `cursorPaging.cursor` can not be used together with `filter` or `sort`.  
        - name: limit | type: integer | description: Maximum number of items to return in the results.  | validation: minimum 0, maximum 100, format int32
        - name: cursor | type: string | description: Pointer to the next or previous page in the list of results.  Pass the relevant cursor token from the `pagingMetadata` object in the previous call's response. Not relevant for the first request.  | validation: maxLength 16000
        - name: filter | type: object | description: Filter object.  
        - name: sort | type: array<Sorting> | description: Sorting options. For example, `[{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]`.  
           - name: fieldName | type: string | description: Name of the field to sort by.  | validation: maxLength 512
           - name: order | type: SortOrder | description: Sort order.  
                 - enum: ASC, DESC
           - name: origin | type: AddressLocation | description: Origin point for geo-distance sorting on a GEO field results are ordered by distance from this point (ASC = nearest first, DESC = farthest first).  
              - name: latitude | type: number | description: Address latitude.  
              - name: longitude | type: number | description: Address longitude.  
 Return type: PROMISE<QueryStoreVariantsResponse>
  - name: variants | type: array<StoreVariant> | description: List of variants based on the specified filters and sorting.  
     - name: _id | type: string | description: Store variant GUID. Comprised of the `productId` and the `variantId`, separated by a hyphen: {productId}.{variantId}.  
     - name: variantId | type: string | description: Variant GUID.  | validation: format GUID
     - name: productId | type: string | description: Product GUID.  
     - name: variantName | type: string | description: Variant name.  | validation: minLength 1, maxLength 80
     - name: productName | type: string | description: Product name.  | validation: minLength 1, maxLength 80
     - name: managedVariant | type: boolean | description: Whether the variant is managed or represents a product.  
     - name: sku | type: string | description: Variant SKU (stock keeping unit).  | validation: maxLength 40
     - name: stock | type: VariantStock | description: Variant inventory status.  
        - name: trackQuantity | type: boolean | description: Whether inventory is being tracked.  
        - name: quantity | type: integer | description: Quantity currently left in inventory.  | validation: minimum 0, maximum 99999, format int32
        - name: inStock | type: boolean | description: Whether the product is currently in stock (relevant only when tracking manually).  
     - name: choices | type: object | description: The selected options of this variant. For example, `{"Color": "Blue", "Size": "Large"}`.  | validation: format map
     - name: collectionIds | type: array<string> | description: Collections that include this variant.  | validation: format GUID
     - name: media | type: PlatformMedia | description: Media items (images, videos) associated with this variant.  | read-only: true 
        - ONE-OF: 
           - name: image | type: string | description:   
           - name: video | type: string | description:   
     - 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
  - name: metadata | type: PlatformPagingMetadata | description: Details on the paged set of results returned.  
     - name: count | type: integer | description: The number of items returned in this response.  | validation: format int32
     - name: offset | type: integer | description: The offset which was requested. Returned if offset paging was used.  | validation: format int32
     - name: total | type: integer | description: The total number of items that match the query. Returned if offset paging was used.  | validation: format int32
     - name: cursors | type: Cursors | description: Cursors to navigate through result pages. Returned if cursor paging was used.  
        - name: next | type: string | description: Cursor string pointing to the next page in the list of results.  | validation: maxLength 16000
        - name: prev | type: string | description: Cursor pointing to the previous page in the list of results.  | validation: maxLength 16000


```

### Examples

### Query store variants (basic)
```javascript
import { products } from "@wix/stores";

const options = {};

async function queryStoreVariants() {
  const response = await products.queryStoreVariants(options);
}

/* Promise resolves to:
 * {
 *   "variants": [
 *     {
 *       "_id": "5376f9ec-b92e-efa9-e4a1-f4f480aa0d3a-00000000-0000-0020-0005-ad9cdc10d3b8",
 *       "variantId": "00000000-0000-0020-0005-ad9cdc10d3b8",
 *       "productId": "5376f9ec-b92e-efa9-e4a1-f4f480aa0d3a",
 *       "variantName": "250g | Stovetop",
 *       "productName": "Indonesian Blend",
 *       "managedVariant": true,
 *       "stock": {
 *         "trackQuantity": false,
 *         "quantity": 0,
 *         "inStock": true
 *       },
 *       "choices": {
 *         "Weight": "250g",
 *         "Ground for": "Stovetop"
 *       },
 *       "collectionIds": [
 *         "32fd0b3a-2d38-2235-7754-78a3f819274a"
 *       ]
 *     }
 *   ],
 *   "pagingMetadata": {
 *     "count": 100,
 *     "offset": 0
 *   },
 *   "totalCount": 12
 * }
 */

```

### queryStoreVariants (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 { products } from '@wix/stores';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed

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


async function queryStoreVariants(query) {
  const response = await myWixClient.products.queryStoreVariants(query);
};
```

---