> 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`). > - 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. - name: offset | type: integer | description: Number of items to skip in the current sort order. - name: filter | type: object | description: Filter object. - name: sort | type: array | description: Sorting options. For example, `[{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]`. - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: QueryStoreVariantsResponse - name: variants | type: array | 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. - name: productId | type: string | description: Product GUID. - name: variantName | type: string | description: Variant name. - name: productName | type: string | description: Product name. - name: managedVariant | type: boolean | description: Whether the variant is managed or represents a product. - name: sku | type: string | description: Variant SKU (stock keeping unit). - 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. - 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"}`. - name: collectionIds | type: array | description: Collections that include this variant. - name: media | type: PlatformMedia | description: Media items (images, videos) associated with this variant. - 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. - name: width | type: integer | description: Original image width. - name: altText | type: string | description: Image alt text. - name: filename | type: string | description: Image filename. - name: video | type: VideoV2 | description: - name: id | type: string | description: WixMedia GUID. - name: resolutions | type: array | description: Available resolutions for the video, starting with the optimal resolution. - 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. - 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. - name: limit | type: integer | description: Number of products that can be preordered after stock reaches zero. - 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. - name: offset | type: integer | description: The offset which was requested. Returned if offset paging was used. - name: total | type: integer | description: The total number of items that match the query. Returned if offset paging was used. - 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. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. ``` ### Examples ### QueryStoreVariants ```curl ~~~cURL curl -X POST \ 'https://www.wixapis.com/stores/v1/variants/query' \ -H 'Content-Type: application/json' \ -H 'Authorization: ' ~~~ ``` --- ## JavaScript SDK ### Schema ``` Method: wixClientAdmin.catalogV1.CatalogReadApi.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. - name: offset | type: integer | description: Number of items to skip in the current sort order. - 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. - 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. - name: filter | type: object | description: Filter object. - name: sort | type: array | description: Sorting options. For example, `[{"fieldName":"sortField1"},{"fieldName":"sortField2","direction":"DESC"}]`. - name: fieldName | type: string | description: Name of the field to sort by. - name: order | type: SortOrder | description: Sort order. - enum: ASC, DESC Return type: PROMISE - name: variants | type: array | 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. - name: productId | type: string | description: Product GUID. - name: variantName | type: string | description: Variant name. - name: productName | type: string | description: Product name. - name: managedVariant | type: boolean | description: Whether the variant is managed or represents a product. - name: sku | type: string | description: Variant SKU (stock keeping unit). - 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. - 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"}`. - name: collectionIds | type: array | description: Collections that include this variant. - name: media | type: PlatformMedia | description: Media items (images, videos) associated with this variant. - 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. - name: limit | type: integer | description: Number of products that can be preordered after stock reaches zero. - 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. - name: offset | type: integer | description: The offset which was requested. Returned if offset paging was used. - name: total | type: integer | description: The total number of items that match the query. Returned if offset paging was used. - 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. - name: prev | type: string | description: Cursor pointing to the previous page in the list of results. ``` ### 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-hosted) Self-hosted 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); }; ``` ---