inventory Itemquery
query
2024-10latest
Returns an InventoryItem object by ID.
Arguments
The ID of the InventoryItem to return.
Was this section helpful?
InventoryItem possible returns
Represents the goods available to be shipped to a customer. It holds essential information about the goods, including SKU and whether it is tracked. Learn more about the relationships between inventory objects.
Was this section helpful?
Code examples for QUERY: inventoryItem
Query Reference for QUERY: inventoryItem
"{\n inventoryItem(id) {\n # InventoryItem fields\n }\n}"
Input Reference for QUERY: inventoryItem
Schema Reference for QUERY: inventoryItem
Display Examples for QUERY: inventoryItem
[ { "example": { "type_name": "inventoryitem", "title": "Get details about a specified inventory item", "query_string": "query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n}", "query_arguments": { "id": "gid://shopify/InventoryItem/30322695" }, "response": { "data": { "inventoryItem": { "id": "gid://shopify/InventoryItem/30322695", "tracked": true, "sku": "element-151" } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/inventory/test/unit/graph_api/admin/inventory_item_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 inventoryItem { inventoryItem(id: \\\"gid://shopify/InventoryItem/30322695\\\") { id tracked sku } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\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 inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\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 inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\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 inventoryItem {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n tracked\n sku\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the InventoryItem to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/InventoryItem/30322695\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "inventoryitem", "title": "Get inventory item levels and product/variant information", "query_string": "query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n}", "query_arguments": { "id": "gid://shopify/InventoryItem/30322695" }, "response": { "data": { "inventoryItem": { "id": "gid://shopify/InventoryItem/30322695", "inventoryLevels": { "edges": [ { "node": { "id": "gid://shopify/InventoryLevel/523463154?inventory_item_id=30322695", "location": { "id": "gid://shopify/Location/346779380", "name": "Ottawa Store" }, "quantities": [ { "name": "available", "quantity": 2 }, { "name": "committed", "quantity": 1 }, { "name": "incoming", "quantity": 0 }, { "name": "on_hand", "quantity": 33 }, { "name": "reserved", "quantity": 30 } ] } } ] }, "variant": { "id": "gid://shopify/ProductVariant/30322695", "title": "151cm", "product": { "id": "gid://shopify/Product/20995642", "title": "Element" } } } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/inventory/test/unit/graph_api/admin/inventory_item_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 inventoryItemToProductVariant { inventoryItem(id: \\\"gid://shopify/InventoryItem/30322695\\\") { id inventoryLevels(first: 1) { edges { node { id location { id name } quantities(names: [\\\"available\\\", \\\"committed\\\", \\\"incoming\\\", \\\"on_hand\\\", \\\"reserved\\\"]) { name quantity } } } } variant { id title product { id title } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\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 inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\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 inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\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 inventoryItemToProductVariant {\n inventoryItem(id: \"gid://shopify/InventoryItem/30322695\") {\n id\n inventoryLevels(first: 1) {\n edges {\n node {\n id\n location {\n id\n name\n }\n quantities(names: [\"available\", \"committed\", \"incoming\", \"on_hand\", \"reserved\"]) {\n name\n quantity\n }\n }\n }\n }\n variant {\n id\n title\n product {\n id\n title\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "id", "description": "The ID of the InventoryItem to return.", "type": { "kind": "SCALAR", "name": "ID", "list": false, "non_null": true }, "defaultValue": null, "typeSignature": "ID!", "isDeprecated": false, "deprecationReason": null }, "key": "id", "argValue": " \"gid://shopify/InventoryItem/30322695\"", "typeKind": "QUERY" } ] } ]