product Variantsquery
Returns a list of product variants.
ProductVariantConnection argumentsProductVariantConnection!
The elements that come after the specified cursor.
Anchor to beforebeforeThe elements that come before the specified cursor.
Anchor to firstfirstThe first
n
elements from the paginated list.The last
n
elements from the paginated list.A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
Reverse the order of the underlying list.
Anchor to savedSearchIdsavedSearchIdThe ID of a saved search. The search’s query string is used as the query argument.
Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
ProductVariantConnection possible returns
The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
A list of nodes that are contained in ProductVariantEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve.
An object that’s used to retrieve cursor information about the current page.
Code examples for QUERY: productVariants
Query Reference for QUERY: productVariants
"{\n productVariants {\n # ProductVariantConnection fields\n }\n}"
Input Reference for QUERY: productVariants
Schema Reference for QUERY: productVariants
Display Examples for QUERY: productVariants
[ { "example": { "type_name": "productvariants", "title": "Get multiple product variants using their IDs and GraphQL aliases", "query_string": "query {\n productVariant1: productVariant(id: \"gid://shopify/ProductVariant/30322695\") {\n id\n title\n }\n productVariant2: productVariant(id: \"gid://shopify/ProductVariant/43729076\") {\n id\n title\n }\n productVariant3: productVariant(id: \"gid://shopify/ProductVariant/113711323\") {\n id\n title\n }\n}", "response": { "data": { "productVariant1": { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm" }, "productVariant2": { "id": "gid://shopify/ProductVariant/43729076", "title": "151cm" }, "productVariant3": { "id": "gid://shopify/ProductVariant/113711323", "title": "155cm" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/product_variant_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { productVariant1: productVariant(id: \\\"gid://shopify/ProductVariant/30322695\\\") { id title } productVariant2: productVariant(id: \\\"gid://shopify/ProductVariant/43729076\\\") { id title } productVariant3: productVariant(id: \\\"gid://shopify/ProductVariant/113711323\\\") { id title } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n productVariant1: productVariant(id: \"gid://shopify/ProductVariant/30322695\") {\n id\n title\n }\n productVariant2: productVariant(id: \"gid://shopify/ProductVariant/43729076\") {\n id\n title\n }\n productVariant3: productVariant(id: \"gid://shopify/ProductVariant/113711323\") {\n id\n title\n }\n }`,\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n productVariant1: productVariant(id: \"gid://shopify/ProductVariant/30322695\") {\n id\n title\n }\n productVariant2: productVariant(id: \"gid://shopify/ProductVariant/43729076\") {\n id\n title\n }\n productVariant3: productVariant(id: \"gid://shopify/ProductVariant/113711323\") {\n id\n title\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n productVariant1: productVariant(id: \"gid://shopify/ProductVariant/30322695\") {\n id\n title\n }\n productVariant2: productVariant(id: \"gid://shopify/ProductVariant/43729076\") {\n id\n title\n }\n productVariant3: productVariant(id: \"gid://shopify/ProductVariant/113711323\") {\n id\n title\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n productVariant1: productVariant(id: \"gid://shopify/ProductVariant/30322695\") {\n id\n title\n }\n productVariant2: productVariant(id: \"gid://shopify/ProductVariant/43729076\") {\n id\n title\n }\n productVariant3: productVariant(id: \"gid://shopify/ProductVariant/113711323\") {\n id\n title\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "productvariants", "title": "Get the IDs of the first 10 product variants", "query_string": "query {\n productVariants(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n}", "query_arguments": { "first": 10 }, "response": { "data": { "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" } } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/product_variant_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { productVariants(first: 10) { edges { node { id } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n productVariants(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n productVariants(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n productVariants(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n productVariants(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "first", "description": "The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).", "type": { "kind": "SCALAR", "name": "Int", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "Int", "isDeprecated": false, "deprecationReason": null }, "key": "first", "argValue": " 10", "typeKind": "QUERY" } ] }, { "example": { "type_name": "productvariants", "title": "Get the first three product variants sorted by available quantity at a location.", "description": "Returns the first three product variants stocked at a location sorted by lowest available quantity.", "query_string": "query {\n productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) {\n edges {\n node {\n id\n inventoryItem {\n inventoryLevel(locationId: \"gid://shopify/Location/124656943\") {\n quantities(names: \"available\") {\n quantity\n name\n }\n }\n }\n }\n }\n }\n}", "response": { "data": { "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" } ] } } } } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/product_variant_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"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 } } } } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) {\n edges {\n node {\n id\n inventoryItem {\n inventoryLevel(locationId: \"gid://shopify/Location/124656943\") {\n quantities(names: \"available\") {\n quantity\n name\n }\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) {\n edges {\n node {\n id\n inventoryItem {\n inventoryLevel(locationId: \"gid://shopify/Location/124656943\") {\n quantities(names: \"available\") {\n quantity\n name\n }\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) {\n edges {\n node {\n id\n inventoryItem {\n inventoryLevel(locationId: \"gid://shopify/Location/124656943\") {\n quantities(names: \"available\") {\n quantity\n name\n }\n }\n }\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n productVariants(first: 3, query: \"location_id:124656943\", sortKey: INVENTORY_LEVELS_AVAILABLE) {\n edges {\n node {\n id\n inventoryItem {\n inventoryLevel(locationId: \"gid://shopify/Location/124656943\") {\n quantities(names: \"available\") {\n quantity\n name\n }\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] }, { "example": { "type_name": "productvariants", "title": "Get the first three product variants updated after the specified date", "description": "Returns the first three product variants updated after January 1, 2021.", "query_string": "query {\n productVariants(first: 3, query: \"updated_at:>2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n}", "response": { "data": { "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" } } } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/merchandising/test/unit/graph_api/admin/product_variant_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { productVariants(first: 3, query: \\\"updated_at:>2021-01-01\\\") { edges { node { id title price updatedAt inventoryQuantity product { id title } } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n productVariants(first: 3, query: \"updated_at:>2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n", "ruby_example": "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n query {\n productVariants(first: 3, query: \"updated_at:>2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n productVariants(first: 3, query: \"updated_at:>2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n productVariants(first: 3, query: \"updated_at:>2021-01-01\") {\n edges {\n node {\n id\n title\n price\n updatedAt\n inventoryQuantity\n product {\n id\n title\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [] } ]