--- title: productVariants - GraphQL Admin description: >- Retrieves a list of [product variants](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductVariant) associated with a [product](https://shopify.dev/docs/api/admin-graphql/latest/objects/Product). A product variant is a specific version of a product that comes in more than one [option](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductOption), such as size or color. For example, if a merchant sells t-shirts with options for size and color, then a small, blue t-shirt would be one product variant and a large, blue t-shirt would be another. Use the `productVariants` query when you need to: - Search for product variants by attributes such as SKU, barcode, or inventory quantity. - Filter product variants by attributes, such as whether they're gift cards or have custom metafields. - Fetch product variants for bulk operations, such as updating prices or inventory. - Preload data for product variants, such as inventory items, selected options, or associated products. The `productVariants` query supports [pagination](https://shopify.dev/docs/api/usage/pagination-graphql) to handle large product catalogs and [saved searches](https://shopify.dev/docs/api/admin-graphql/latest/queries/productVariants#arguments-savedSearchId) for frequently used product variant queries. The `productVariants` query returns product variants with their associated metadata, including: - Basic product variant information (for example, title, SKU, barcode, price, and inventory) - Media attachments (for example, images and videos) - Associated products, selling plans, bundles, and metafields Learn more about working with [Shopify's product model](https://shopify.dev/docs/apps/build/graphql/migrate/new-product-model/product-model-components). api_version: 2026-01 api_name: admin type: query api_type: graphql source_url: html: 'https://shopify.dev/docs/api/admin-graphql/latest/queries/productVariants' md: 'https://shopify.dev/docs/api/admin-graphql/latest/queries/productVariants.md' --- # product​Variants query Retrieves a list of [product variants](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductVariant) associated with a [product](https://shopify.dev/docs/api/admin-graphql/latest/objects/Product). A product variant is a specific version of a product that comes in more than one [option](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductOption), such as size or color. For example, if a merchant sells t-shirts with options for size and color, then a small, blue t-shirt would be one product variant and a large, blue t-shirt would be another. Use the `productVariants` query when you need to: * Search for product variants by attributes such as SKU, barcode, or inventory quantity. * Filter product variants by attributes, such as whether they're gift cards or have custom metafields. * Fetch product variants for bulk operations, such as updating prices or inventory. * Preload data for product variants, such as inventory items, selected options, or associated products. The `productVariants` query supports [pagination](https://shopify.dev/docs/api/usage/pagination-graphql) to handle large product catalogs and [saved searches](https://shopify.dev/docs/api/admin-graphql/latest/queries/productVariants#arguments-savedSearchId) for frequently used product variant queries. The `productVariants` query returns product variants with their associated metadata, including: * Basic product variant information (for example, title, SKU, barcode, price, and inventory) * Media attachments (for example, images and videos) * Associated products, selling plans, bundles, and metafields Learn more about working with [Shopify's product model](https://shopify.dev/docs/apps/build/graphql/migrate/new-product-model/product-model-components). ## ProductVariantConnection arguments [ProductVariantConnection!](https://shopify.dev/docs/api/admin-graphql/latest/connections/ProductVariantConnection) * after * before * first * last * query * reverse * savedSearchId * sortKey *** ## Possible returns * edges * nodes * pageInfo *** ## Examples * ### Retrieve a list of product variants for a product #### Description Retrieve the first ten product variants for a product. The example returns the IDs and titles of the product variants. The \`pageInfo\` field is also included, which contains \[pagination]\(https://shopify.dev/docs/api/usage/pagination-graphql) information. Learn more about using \[Shopify API search syntax]\(https://shopify.dev/docs/api/usage/search-syntax) to filter products. #### Query ```graphql query ProductVariantsList { productVariants(first: 10, query: "product_id:20995642") { nodes { id title } pageInfo { startCursor endCursor } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query ProductVariantsList { productVariants(first: 10, query: \"product_id:20995642\") { nodes { id title } pageInfo { startCursor endCursor } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query ProductVariantsList { productVariants(first: 10, query: "product_id:20995642") { nodes { id title } pageInfo { startCursor endCursor } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query ProductVariantsList { productVariants(first: 10, query: "product_id:20995642") { nodes { id title } pageInfo { startCursor endCursor } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query ProductVariantsList { productVariants(first: 10, query: "product_id:20995642") { nodes { id title } pageInfo { startCursor endCursor } } }`, }); ``` #### Response ```json { "productVariants": { "nodes": [ { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm" }, { "id": "gid://shopify/ProductVariant/113711323", "title": "155cm" }, { "id": "gid://shopify/ProductVariant/236948360", "title": "158cm" } ], "pageInfo": { "startCursor": "eyJsYXN0X2lkIjozMDMyMjY5NSwibGFzdF92YWx1ZSI6IjMwMzIyNjk1In0=", "endCursor": "eyJsYXN0X2lkIjoyMzY5NDgzNjAsImxhc3RfdmFsdWUiOiIyMzY5NDgzNjAifQ==" } } } ``` * ### Retrieve product variants by SKU pattern #### Description Retrieve product variants using a \[SKU]\(https://help.shopify.com/manual/products/details/sku) pattern. This example uses a wildcard search to find all product variants with SKUs that start with "element". The \`\*\` wildcard allows you to find multiple variants that share a common SKU prefix, which is useful for finding related products or product lines. Learn more about using \[Shopify API search syntax]\(https://shopify.dev/docs/api/usage/search-syntax) to filter products. #### Query ```graphql query { productVariants(first: 10, query: "sku:element*") { edges { node { id title sku } } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { productVariants(first: 10, query: \"sku:element*\") { edges { node { id title sku } } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { productVariants(first: 10, query: "sku:element*") { edges { node { id title sku } } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { productVariants(first: 10, query: "sku:element*") { edges { node { id title sku } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { productVariants(first: 10, query: "sku:element*") { edges { node { id title sku } } } }`, }); ``` #### Response ```json { "productVariants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm", "sku": "element-151" } }, { "node": { "id": "gid://shopify/ProductVariant/113711323", "title": "155cm", "sku": "element-155" } }, { "node": { "id": "gid://shopify/ProductVariant/236948360", "title": "158cm", "sku": "element-158" } } ] } } ``` * ### Retrieve product variants by available quantity at a location #### Description Retrieve the first three product variants stocked at a location, sorted by lowest available quantity. This example returns the IDs and inventory quantities of the product variants. Learn more about using \[Shopify API search syntax]\(https://shopify.dev/docs/api/usage/search-syntax) to filter products. #### Query ```graphql query { productVariants(first: 3, query: "location_id:124656943", sortKey: INVENTORY_LEVELS_AVAILABLE) { edges { node { id inventoryItem { inventoryLevel(locationId: "gid://shopify/Location/124656943") { quantities(names: "available") { quantity name } } } } } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) { edges { node { id inventoryItem { inventoryLevel(locationId: \"gid://shopify/Location/124656943\") { quantities(names: \"available\") { quantity name } } } } } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { productVariants(first: 3, query: "location_id:124656943", sortKey: INVENTORY_LEVELS_AVAILABLE) { edges { node { id inventoryItem { inventoryLevel(locationId: "gid://shopify/Location/124656943") { quantities(names: "available") { quantity name } } } } } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { productVariants(first: 3, query: "location_id:124656943", sortKey: INVENTORY_LEVELS_AVAILABLE) { edges { node { id inventoryItem { inventoryLevel(locationId: "gid://shopify/Location/124656943") { quantities(names: "available") { quantity name } } } } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { productVariants(first: 3, query: "location_id:124656943", sortKey: INVENTORY_LEVELS_AVAILABLE) { edges { node { id inventoryItem { inventoryLevel(locationId: "gid://shopify/Location/124656943") { quantities(names: "available") { quantity name } } } } } } }`, }); ``` #### Response ```json { "productVariants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/419425742", "inventoryItem": { "inventoryLevel": { "quantities": [ { "quantity": 0, "name": "available" } ] } } } }, { "node": { "id": "gid://shopify/ProductVariant/30322695", "inventoryItem": { "inventoryLevel": { "quantities": [ { "quantity": 1, "name": "available" } ] } } } }, { "node": { "id": "gid://shopify/ProductVariant/43729076", "inventoryItem": { "inventoryLevel": { "quantities": [ { "quantity": 1, "name": "available" } ] } } } } ] } } ``` * ### Retrieve product variants by product IDs #### Description Retrieve product variants for a specific set of product IDs using the \`product\_ids\` query parameter. This example returns the IDs and titles of the product variants for the specified products. The \`product\` field is also included, which contains the ID of the product that's associated with the product variant. Learn more about using \[Shopify API search syntax]\(https://shopify.dev/docs/api/usage/search-syntax) to filter products. #### Query ```graphql query { productVariants(first: 100, query: "product_ids:20995642,108828309") { edges { node { id title product { id } } } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { productVariants(first: 100, query: \"product_ids:20995642,108828309\") { edges { node { id title product { id } } } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { productVariants(first: 100, query: "product_ids:20995642,108828309") { edges { node { id title product { id } } } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { productVariants(first: 100, query: "product_ids:20995642,108828309") { edges { node { id title product { id } } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { productVariants(first: 100, query: "product_ids:20995642,108828309") { edges { node { id title product { id } } } } }`, }); ``` #### Response ```json { "productVariants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm", "product": { "id": "gid://shopify/Product/20995642" } } }, { "node": { "id": "gid://shopify/ProductVariant/43729076", "title": "151cm", "product": { "id": "gid://shopify/Product/108828309" } } }, { "node": { "id": "gid://shopify/ProductVariant/113711323", "title": "155cm", "product": { "id": "gid://shopify/Product/20995642" } } }, { "node": { "id": "gid://shopify/ProductVariant/236948360", "title": "158cm", "product": { "id": "gid://shopify/Product/20995642" } } } ] } } ``` * ### Retrieve product variants by publication statuses #### Description Retrieve product variants by \`published\_status\` and \`product\_publication\_status\`. This example returns the title and \[SKU]\(https://help.shopify.com/manual/products/details/sku) of product variants that are both published and approved. A product variant is \`published\` when it's visible and available for purchase on a sales channel, such as the Online Store. A product variant is \`approved\` when it has passed any content review or approval workflows configured for the store. Learn more about using \[Shopify API search syntax]\(https://shopify.dev/docs/api/usage/search-syntax) to filter products. #### Query ```graphql query { productVariants(first: 1, query: "published_status:published AND product_publication_status:approved") { edges { node { title sku } } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { productVariants(first: 1, query: \"published_status:published AND product_publication_status:approved\") { edges { node { title sku } } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { productVariants(first: 1, query: "published_status:published AND product_publication_status:approved") { edges { node { title sku } } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { productVariants(first: 1, query: "published_status:published AND product_publication_status:approved") { edges { node { title sku } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { productVariants(first: 1, query: "published_status:published AND product_publication_status:approved") { edges { node { title sku } } } }`, }); ``` #### Response ```json { "productVariants": { "edges": [ { "node": { "title": "151cm", "sku": "element-151" } } ] } } ``` * ### Retrieve the IDs of the first 10 product variants #### Description Retrieve the first 10 product variants in a store. The example returns the IDs of the product variants. #### Query ```graphql query { productVariants(first: 10) { edges { node { id } } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { productVariants(first: 10) { edges { node { id } } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { productVariants(first: 10) { edges { node { id } } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { productVariants(first: 10) { edges { node { id } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { productVariants(first: 10) { edges { node { id } } } }`, }); ``` #### Response ```json { "productVariants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/30322695" } }, { "node": { "id": "gid://shopify/ProductVariant/43729076" } }, { "node": { "id": "gid://shopify/ProductVariant/113711323" } }, { "node": { "id": "gid://shopify/ProductVariant/138327650" } }, { "node": { "id": "gid://shopify/ProductVariant/236948360" } }, { "node": { "id": "gid://shopify/ProductVariant/330284860" } }, { "node": { "id": "gid://shopify/ProductVariant/389013007" } }, { "node": { "id": "gid://shopify/ProductVariant/419425742" } }, { "node": { "id": "gid://shopify/ProductVariant/438458761" } }, { "node": { "id": "gid://shopify/ProductVariant/445365074" } } ] } } ``` * ### Retrieve the first three product variants updated after a specified date #### Description Retrieve the first three products updated after 2021-01-01. This example returns the IDs, titles, prices, inventory quantities, and the date and time the product variant was last updated. The \`product\` field is also included, which contains the ID and title of the product that's associated with the product variant. Learn more about using \[Shopify API search syntax]\(https://shopify.dev/docs/api/usage/search-syntax) to filter products. #### Query ```graphql query { productVariants(first: 3, query: "updated_at:>2021-01-01") { edges { node { id title price updatedAt inventoryQuantity product { id title } } } } } ``` #### cURL ```bash curl -X POST \ https://your-development-store.myshopify.com/admin/api/2026-01/graphql.json \ -H 'Content-Type: application/json' \ -H 'X-Shopify-Access-Token: {access_token}' \ -d '{ "query": "query { productVariants(first: 3, query: \"updated_at:>2021-01-01\") { edges { node { id title price updatedAt inventoryQuantity product { id title } } } } }" }' ``` #### React Router ```javascript import { authenticate } from "../shopify.server"; export const loader = async ({request}) => { const { admin } = await authenticate.admin(request); const response = await admin.graphql( `#graphql query { productVariants(first: 3, query: "updated_at:>2021-01-01") { edges { node { id title price updatedAt inventoryQuantity product { id title } } } } }`, ); const json = await response.json(); return json.data; } ``` #### Ruby ```ruby session = ShopifyAPI::Auth::Session.new( shop: "your-development-store.myshopify.com", access_token: access_token ) client = ShopifyAPI::Clients::Graphql::Admin.new( session: session ) query = <<~QUERY query { productVariants(first: 3, query: "updated_at:>2021-01-01") { edges { node { id title price updatedAt inventoryQuantity product { id title } } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { productVariants(first: 3, query: "updated_at:>2021-01-01") { edges { node { id title price updatedAt inventoryQuantity product { id title } } } } }`, }); ``` #### Response ```json { "productVariants": { "edges": [ { "node": { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm", "price": "10.00", "updatedAt": "2021-11-11T11:11:11Z", "inventoryQuantity": 3, "product": { "id": "gid://shopify/Product/20995642", "title": "Element" } } }, { "node": { "id": "gid://shopify/ProductVariant/43729076", "title": "151cm", "price": "10.00", "updatedAt": "2021-11-11T11:11:11Z", "inventoryQuantity": 1, "product": { "id": "gid://shopify/Product/108828309", "title": "Draft" } } }, { "node": { "id": "gid://shopify/ProductVariant/113711323", "title": "155cm", "price": "15.00", "updatedAt": "2021-11-11T11:11:11Z", "inventoryQuantity": 15, "product": { "id": "gid://shopify/Product/20995642", "title": "Element" } } } ] } } ```