Version: 2024-10
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 ProductMetafield($namespace: String!, $key: String!, $ownerId: ID!) { product(id: $ownerId) { linerMaterial: metafield(namespace: $namespace, key: $key) { value } } }\",\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"liner_material\",\n \"ownerId\": \"gid://shopify/Product/108828309\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query ProductMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n product(id: $ownerId) {\n linerMaterial: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"liner_material\",\n \"ownerId\": \"gid://shopify/Product/108828309\"\n },\n },\n});\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 ProductMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n product(id: $ownerId) {\n linerMaterial: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY\n\nvariables = {\n \"namespace\": \"my_fields\",\n \"key\": \"liner_material\",\n \"ownerId\": \"gid://shopify/Product/108828309\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query ProductMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n product(id: $ownerId) {\n linerMaterial: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY;\n\n$variables = [\n \"namespace\" => \"my_fields\",\n \"key\" => \"liner_material\",\n \"ownerId\" => \"gid://shopify/Product/108828309\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query ProductMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n product(id: $ownerId) {\n linerMaterial: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n {\n variables: {\n \"namespace\": \"my_fields\",\n \"key\": \"liner_material\",\n \"ownerId\": \"gid://shopify/Product/108828309\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query ProductMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n product(id: $ownerId) {\n linerMaterial: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n}"
input: { "namespace": "my_fields", "key": "liner_material", "ownerId": "gid://shopify/Product/108828309" }
response: { "data": { "product": { "linerMaterial": { "value": "synthetic leather" } } } }
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 { node(id: \\\"gid://shopify/Product/108828309\\\") { id ... on Product { title } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n node(id: \"gid://shopify/Product/108828309\") {\n id\n ... on Product {\n title\n }\n }\n }`,\n});\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 node(id: \"gid://shopify/Product/108828309\") {\n id\n ... on Product {\n title\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n node(id: \"gid://shopify/Product/108828309\") {\n id\n ... on Product {\n title\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n node(id: \"gid://shopify/Product/108828309\") {\n id\n ... on Product {\n title\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n node(id: \"gid://shopify/Product/108828309\") {\n id\n ... on Product {\n title\n }\n }\n}"
input: null
response: { "data": { "node": { "id": "gid://shopify/Product/108828309", "title": "Draft" } } }
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 { product(id: \\\"gid://shopify/Product/108828309\\\") { collections(first: 5) { edges { node { handle } } } createdAt defaultCursor description descriptionHtml featuredImage { id } feedback { details { messages { message } } } giftCardTemplateSuffix handle hasOnlyDefaultVariant hasOutOfStockVariants id images(first: 5) { edges { node { id } } } inCollection(id: \\\"gid://shopify/Collection/1007901140\\\") isGiftCard legacyResourceId metafield(key: \\\"app_key\\\", namespace: \\\"affiliates\\\") { description } metafields(first: 5) { edges { node { description } } } onlineStorePreviewUrl onlineStoreUrl options { name } priceRange { maxVariantPrice { amount } minVariantPrice { amount } } productType resourcePublicationsCount { count } availablePublicationsCount { count } publishedAt resourcePublications(first: 5) { edges { node { isPublished } } } resourcePublicationOnCurrentPublication { publication { name id } publishDate isPublished } seo { title } storefrontId tags templateSuffix title totalInventory tracksInventory unpublishedPublications(first: 5) { edges { node { name } } } updatedAt variants(first: 5) { edges { node { displayName } } } variantsCount { count } vendor } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n product(id: \"gid://shopify/Product/108828309\") {\n collections(first: 5) {\n edges {\n node {\n handle\n }\n }\n }\n createdAt\n defaultCursor\n description\n descriptionHtml\n featuredImage {\n id\n }\n feedback {\n details {\n messages {\n message\n }\n }\n }\n giftCardTemplateSuffix\n handle\n hasOnlyDefaultVariant\n hasOutOfStockVariants\n id\n images(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n inCollection(id: \"gid://shopify/Collection/1007901140\")\n isGiftCard\n legacyResourceId\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n description\n }\n }\n }\n onlineStorePreviewUrl\n onlineStoreUrl\n options {\n name\n }\n priceRange {\n maxVariantPrice {\n amount\n }\n minVariantPrice {\n amount\n }\n }\n productType\n resourcePublicationsCount {\n count\n }\n availablePublicationsCount {\n count\n }\n publishedAt\n resourcePublications(first: 5) {\n edges {\n node {\n isPublished\n }\n }\n }\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\n }\n seo {\n title\n }\n storefrontId\n tags\n templateSuffix\n title\n totalInventory\n tracksInventory\n unpublishedPublications(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n updatedAt\n variants(first: 5) {\n edges {\n node {\n displayName\n }\n }\n }\n variantsCount {\n count\n }\n vendor\n }\n }`,\n});\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 product(id: \"gid://shopify/Product/108828309\") {\n collections(first: 5) {\n edges {\n node {\n handle\n }\n }\n }\n createdAt\n defaultCursor\n description\n descriptionHtml\n featuredImage {\n id\n }\n feedback {\n details {\n messages {\n message\n }\n }\n }\n giftCardTemplateSuffix\n handle\n hasOnlyDefaultVariant\n hasOutOfStockVariants\n id\n images(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n inCollection(id: \"gid://shopify/Collection/1007901140\")\n isGiftCard\n legacyResourceId\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n description\n }\n }\n }\n onlineStorePreviewUrl\n onlineStoreUrl\n options {\n name\n }\n priceRange {\n maxVariantPrice {\n amount\n }\n minVariantPrice {\n amount\n }\n }\n productType\n resourcePublicationsCount {\n count\n }\n availablePublicationsCount {\n count\n }\n publishedAt\n resourcePublications(first: 5) {\n edges {\n node {\n isPublished\n }\n }\n }\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\n }\n seo {\n title\n }\n storefrontId\n tags\n templateSuffix\n title\n totalInventory\n tracksInventory\n unpublishedPublications(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n updatedAt\n variants(first: 5) {\n edges {\n node {\n displayName\n }\n }\n }\n variantsCount {\n count\n }\n vendor\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n collections(first: 5) {\n edges {\n node {\n handle\n }\n }\n }\n createdAt\n defaultCursor\n description\n descriptionHtml\n featuredImage {\n id\n }\n feedback {\n details {\n messages {\n message\n }\n }\n }\n giftCardTemplateSuffix\n handle\n hasOnlyDefaultVariant\n hasOutOfStockVariants\n id\n images(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n inCollection(id: \"gid://shopify/Collection/1007901140\")\n isGiftCard\n legacyResourceId\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n description\n }\n }\n }\n onlineStorePreviewUrl\n onlineStoreUrl\n options {\n name\n }\n priceRange {\n maxVariantPrice {\n amount\n }\n minVariantPrice {\n amount\n }\n }\n productType\n resourcePublicationsCount {\n count\n }\n availablePublicationsCount {\n count\n }\n publishedAt\n resourcePublications(first: 5) {\n edges {\n node {\n isPublished\n }\n }\n }\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\n }\n seo {\n title\n }\n storefrontId\n tags\n templateSuffix\n title\n totalInventory\n tracksInventory\n unpublishedPublications(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n updatedAt\n variants(first: 5) {\n edges {\n node {\n displayName\n }\n }\n }\n variantsCount {\n count\n }\n vendor\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n collections(first: 5) {\n edges {\n node {\n handle\n }\n }\n }\n createdAt\n defaultCursor\n description\n descriptionHtml\n featuredImage {\n id\n }\n feedback {\n details {\n messages {\n message\n }\n }\n }\n giftCardTemplateSuffix\n handle\n hasOnlyDefaultVariant\n hasOutOfStockVariants\n id\n images(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n inCollection(id: \"gid://shopify/Collection/1007901140\")\n isGiftCard\n legacyResourceId\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n description\n }\n }\n }\n onlineStorePreviewUrl\n onlineStoreUrl\n options {\n name\n }\n priceRange {\n maxVariantPrice {\n amount\n }\n minVariantPrice {\n amount\n }\n }\n productType\n resourcePublicationsCount {\n count\n }\n availablePublicationsCount {\n count\n }\n publishedAt\n resourcePublications(first: 5) {\n edges {\n node {\n isPublished\n }\n }\n }\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\n }\n seo {\n title\n }\n storefrontId\n tags\n templateSuffix\n title\n totalInventory\n tracksInventory\n unpublishedPublications(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n updatedAt\n variants(first: 5) {\n edges {\n node {\n displayName\n }\n }\n }\n variantsCount {\n count\n }\n vendor\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n product(id: \"gid://shopify/Product/108828309\") {\n collections(first: 5) {\n edges {\n node {\n handle\n }\n }\n }\n createdAt\n defaultCursor\n description\n descriptionHtml\n featuredImage {\n id\n }\n feedback {\n details {\n messages {\n message\n }\n }\n }\n giftCardTemplateSuffix\n handle\n hasOnlyDefaultVariant\n hasOutOfStockVariants\n id\n images(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n inCollection(id: \"gid://shopify/Collection/1007901140\")\n isGiftCard\n legacyResourceId\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n description\n }\n }\n }\n onlineStorePreviewUrl\n onlineStoreUrl\n options {\n name\n }\n priceRange {\n maxVariantPrice {\n amount\n }\n minVariantPrice {\n amount\n }\n }\n productType\n resourcePublicationsCount {\n count\n }\n availablePublicationsCount {\n count\n }\n publishedAt\n resourcePublications(first: 5) {\n edges {\n node {\n isPublished\n }\n }\n }\n resourcePublicationOnCurrentPublication {\n publication {\n name\n id\n }\n publishDate\n isPublished\n }\n seo {\n title\n }\n storefrontId\n tags\n templateSuffix\n title\n totalInventory\n tracksInventory\n unpublishedPublications(first: 5) {\n edges {\n node {\n name\n }\n }\n }\n updatedAt\n variants(first: 5) {\n edges {\n node {\n displayName\n }\n }\n }\n variantsCount {\n count\n }\n vendor\n }\n}"
input: null
response: { "data": { "product": { "collections": { "edges": [ { "node": { "handle": "reorder_custom" } }, { "node": { "handle": "everything" } }, { "node": { "handle": "snowboards" } }, { "node": { "handle": "everything-custom" } }, { "node": { "handle": "featured_asc" } } ] }, "createdAt": "2005-01-02T00:00:00Z", "defaultCursor": "eyJsaW1pdCI6MSwib3JkZXIiOiJpZCBhc2MiLCJsYXN0X2lkIjoxMDg4MjgzMDksImxhc3RfdmFsdWUiOjEwODgyODMwOSwiZGlyZWN0aW9uIjoibmV4dCJ9", "description": "good board", "descriptionHtml": "<p>good board</p>", "featuredImage": { "id": "gid://shopify/ProductImage/183532652" }, "feedback": null, "giftCardTemplateSuffix": null, "handle": "draft", "hasOnlyDefaultVariant": false, "hasOutOfStockVariants": false, "id": "gid://shopify/Product/108828309", "images": { "edges": [ { "node": { "id": "gid://shopify/ProductImage/183532652" } }, { "node": { "id": "gid://shopify/ProductImage/731367280" } } ] }, "inCollection": true, "isGiftCard": false, "legacyResourceId": "108828309", "metafield": null, "metafields": { "edges": [ { "node": { "description": "German product title" } }, { "node": { "description": null } }, { "node": { "description": null } }, { "node": { "description": null } }, { "node": { "description": null } } ] }, "onlineStorePreviewUrl": "https://www.snowdevil.ca/products/draft", "onlineStoreUrl": "https://www.snowdevil.ca/products/draft", "options": [ { "name": "Title" } ], "priceRange": { "maxVariantPrice": { "amount": "1000.0" }, "minVariantPrice": { "amount": "1000.0" } }, "productType": "Snowboards", "resourcePublicationsCount": { "count": 4 }, "availablePublicationsCount": { "count": 4 }, "publishedAt": "2005-01-02T00:00:00Z", "resourcePublications": { "edges": [ { "node": { "isPublished": true } }, { "node": { "isPublished": true } }, { "node": { "isPublished": true } } ] }, "resourcePublicationOnCurrentPublication": { "publication": { "name": "Generic Channel", "id": "gid://shopify/Publication/762454635" }, "publishDate": "2005-01-02T00:00:00Z", "isPublished": true }, "seo": { "title": null }, "storefrontId": "gid://shopify/Product/108828309", "tags": [ "Deepsnow", "Dub Quote\"s", "quote's", "Wooden Core" ], "templateSuffix": null, "title": "Draft", "totalInventory": 1, "tracksInventory": true, "unpublishedPublications": { "edges": [ { "node": { "name": "" } }, { "node": { "name": "" } }, { "node": { "name": "" } }, { "node": { "name": "" } }, { "node": { "name": "Private app with all permissions" } } ] }, "updatedAt": "2005-01-02T00:00:00Z", "variants": { "edges": [ { "node": { "displayName": "Draft - 151cm" } } ] }, "variantsCount": { "count": 1 }, "vendor": "Arbor" } } }
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 ProductMetafields($ownerId: ID!) { product(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }\",\n \"variables\": {\n \"ownerId\": \"gid://shopify/Product/108828309\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query ProductMetafields($ownerId: ID!) {\n product(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"ownerId\": \"gid://shopify/Product/108828309\"\n },\n },\n});\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 ProductMetafields($ownerId: ID!) {\n product(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"ownerId\": \"gid://shopify/Product/108828309\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query ProductMetafields($ownerId: ID!) {\n product(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"ownerId\" => \"gid://shopify/Product/108828309\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query ProductMetafields($ownerId: ID!) {\n product(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"ownerId\": \"gid://shopify/Product/108828309\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query ProductMetafields($ownerId: ID!) {\n product(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n}"
input: { "ownerId": "gid://shopify/Product/108828309" }
response: { "data": { "product": { "metafields": { "edges": [ { "node": { "namespace": "my_fields", "key": "liner_material", "value": "synthetic leather" } } ] } } } }
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 ProductMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) { product(id: $ownerId) { metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) { edges { node { name namespace key type { name } } } } } }\",\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Product/108828309\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query ProductMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n product(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Product/108828309\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n },\n },\n});\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 ProductMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n product(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Product/108828309\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query ProductMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n product(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"pinnedStatus\" => \"PINNED\",\n \"ownerId\" => \"gid://shopify/Product/108828309\",\n \"first\" => 10,\n \"sortKey\" => \"PINNED_POSITION\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query ProductMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n product(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Product/108828309\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query ProductMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n product(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n}"
input: { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Product/108828309", "first": 10, "sortKey": "PINNED_POSITION" }
response: { "data": { "product": { "metafieldDefinitions": { "edges": [ { "node": { "name": "Sole Material", "namespace": "my_fields", "key": "sole_material", "type": { "name": "single_line_text_field" } } }, { "node": { "name": "Liner Material", "namespace": "my_fields", "key": "liner_material", "type": { "name": "single_line_text_field" } } } ] } } } }
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 { product(id: \\\"gid://shopify/Product/108828309\\\") { contextualPricing(context: {country: CA}) { priceRange { maxVariantPrice { amount currencyCode } minVariantPrice { amount currencyCode } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n product(id: \"gid://shopify/Product/108828309\") {\n contextualPricing(context: {country: CA}) {\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n});\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 product(id: \"gid://shopify/Product/108828309\") {\n contextualPricing(context: {country: CA}) {\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n contextualPricing(context: {country: CA}) {\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n contextualPricing(context: {country: CA}) {\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n product(id: \"gid://shopify/Product/108828309\") {\n contextualPricing(context: {country: CA}) {\n priceRange {\n maxVariantPrice {\n amount\n currencyCode\n }\n minVariantPrice {\n amount\n currencyCode\n }\n }\n }\n }\n}"
input: null
response: { "data": { "product": { "contextualPricing": { "priceRange": { "maxVariantPrice": { "amount": "12.99", "currencyCode": "CAD" }, "minVariantPrice": { "amount": "12.99", "currencyCode": "CAD" } } } } } }
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 { product(id: \\\"gid://shopify/Product/108828309\\\") { title description onlineStoreUrl } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n onlineStoreUrl\n }\n }`,\n});\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 product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n onlineStoreUrl\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n onlineStoreUrl\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n onlineStoreUrl\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n description\n onlineStoreUrl\n }\n}"
input: null
response: { "data": { "product": { "title": "Draft", "description": "good board", "onlineStoreUrl": "https://www.snowdevil.ca/products/draft" } } }
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 { product(id: \\\"gid://shopify/Product/108828309\\\") { title totalInventory } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n totalInventory\n }\n }`,\n});\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 product(id: \"gid://shopify/Product/108828309\") {\n title\n totalInventory\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n totalInventory\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n totalInventory\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n totalInventory\n }\n}"
input: null
response: { "data": { "product": { "title": "Draft", "totalInventory": 1 } } }
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 TranslationsAndLocalizations { product(id: \\\"gid://shopify/Product/273955669\\\") { title descriptionHtml translations(locale: \\\"fr\\\") { key value } localizations: translations(locale: \\\"fr\\\", marketId: \\\"gid://shopify/Market/249692835\\\") { key value } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query TranslationsAndLocalizations {\n product(id: \"gid://shopify/Product/273955669\") {\n title\n descriptionHtml\n translations(locale: \"fr\") {\n key\n value\n }\n localizations: translations(locale: \"fr\", marketId: \"gid://shopify/Market/249692835\") {\n key\n value\n }\n }\n }`,\n});\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 TranslationsAndLocalizations {\n product(id: \"gid://shopify/Product/273955669\") {\n title\n descriptionHtml\n translations(locale: \"fr\") {\n key\n value\n }\n localizations: translations(locale: \"fr\", marketId: \"gid://shopify/Market/249692835\") {\n key\n value\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query TranslationsAndLocalizations {\n product(id: \"gid://shopify/Product/273955669\") {\n title\n descriptionHtml\n translations(locale: \"fr\") {\n key\n value\n }\n localizations: translations(locale: \"fr\", marketId: \"gid://shopify/Market/249692835\") {\n key\n value\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query TranslationsAndLocalizations {\n product(id: \"gid://shopify/Product/273955669\") {\n title\n descriptionHtml\n translations(locale: \"fr\") {\n key\n value\n }\n localizations: translations(locale: \"fr\", marketId: \"gid://shopify/Market/249692835\") {\n key\n value\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query TranslationsAndLocalizations {\n product(id: \"gid://shopify/Product/273955669\") {\n title\n descriptionHtml\n translations(locale: \"fr\") {\n key\n value\n }\n localizations: translations(locale: \"fr\", marketId: \"gid://shopify/Market/249692835\") {\n key\n value\n }\n }\n}"
input: null
response: { "data": { "product": { "title": "Wool sweater", "descriptionHtml": "<p>It is very warm!</p>", "translations": [ { "key": "body_html", "value": "<p>C’est très chaud!</p>" }, { "key": "title", "value": "Pull en laine" } ], "localizations": [ { "key": "title", "value": "Chandail en laine" } ] } } }
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 { product(id: \\\"gid://shopify/Product/108828309\\\") { title variants(first: 10) { edges { node { selectedOptions { name value } media(first: 10) { edges { node { alt mediaContentType status __typename ... on MediaImage { id preview { image { originalSrc } } __typename } } } } } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n variants(first: 10) {\n edges {\n node {\n selectedOptions {\n name\n value\n }\n media(first: 10) {\n edges {\n node {\n alt\n mediaContentType\n status\n __typename\n ... on MediaImage {\n id\n preview {\n image {\n originalSrc\n }\n }\n __typename\n }\n }\n }\n }\n }\n }\n }\n }\n }`,\n});\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 product(id: \"gid://shopify/Product/108828309\") {\n title\n variants(first: 10) {\n edges {\n node {\n selectedOptions {\n name\n value\n }\n media(first: 10) {\n edges {\n node {\n alt\n mediaContentType\n status\n __typename\n ... on MediaImage {\n id\n preview {\n image {\n originalSrc\n }\n }\n __typename\n }\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n variants(first: 10) {\n edges {\n node {\n selectedOptions {\n name\n value\n }\n media(first: 10) {\n edges {\n node {\n alt\n mediaContentType\n status\n __typename\n ... on MediaImage {\n id\n preview {\n image {\n originalSrc\n }\n }\n __typename\n }\n }\n }\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n variants(first: 10) {\n edges {\n node {\n selectedOptions {\n name\n value\n }\n media(first: 10) {\n edges {\n node {\n alt\n mediaContentType\n status\n __typename\n ... on MediaImage {\n id\n preview {\n image {\n originalSrc\n }\n }\n __typename\n }\n }\n }\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n variants(first: 10) {\n edges {\n node {\n selectedOptions {\n name\n value\n }\n media(first: 10) {\n edges {\n node {\n alt\n mediaContentType\n status\n __typename\n ... on MediaImage {\n id\n preview {\n image {\n originalSrc\n }\n }\n __typename\n }\n }\n }\n }\n }\n }\n }\n }\n}"
input: null
response: { "data": { "product": { "title": "Draft", "variants": { "edges": [ { "node": { "selectedOptions": [ { "name": "Title", "value": "151cm" } ], "media": { "edges": [ { "node": { "alt": "", "mediaContentType": "IMAGE", "status": "READY", "__typename": "MediaImage", "id": "gid://shopify/MediaImage/853695510", "preview": { "image": { "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1730761095" } } } } ] } } } ] } } } }
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 { product(id: \\\"gid://shopify/Product/49527214\\\") { title publishedInCA: publishedInContext(context: {country: CA}) publishedInGB: publishedInContext(context: {country: GB}) publishedInUS: publishedInContext(context: {country: US}) } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n product(id: \"gid://shopify/Product/49527214\") {\n title\n publishedInCA: publishedInContext(context: {country: CA})\n publishedInGB: publishedInContext(context: {country: GB})\n publishedInUS: publishedInContext(context: {country: US})\n }\n }`,\n});\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 product(id: \"gid://shopify/Product/49527214\") {\n title\n publishedInCA: publishedInContext(context: {country: CA})\n publishedInGB: publishedInContext(context: {country: GB})\n publishedInUS: publishedInContext(context: {country: US})\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n product(id: \"gid://shopify/Product/49527214\") {\n title\n publishedInCA: publishedInContext(context: {country: CA})\n publishedInGB: publishedInContext(context: {country: GB})\n publishedInUS: publishedInContext(context: {country: US})\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n product(id: \"gid://shopify/Product/49527214\") {\n title\n publishedInCA: publishedInContext(context: {country: CA})\n publishedInGB: publishedInContext(context: {country: GB})\n publishedInUS: publishedInContext(context: {country: US})\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n product(id: \"gid://shopify/Product/49527214\") {\n title\n publishedInCA: publishedInContext(context: {country: CA})\n publishedInGB: publishedInContext(context: {country: GB})\n publishedInUS: publishedInContext(context: {country: US})\n }\n}"
input: null
response: { "data": { "product": { "title": "Alarm clock", "publishedInCA": true, "publishedInGB": false, "publishedInUS": true } } }
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 ProductImageCount($productId: ID!) { product(id: $productId) { mediaCount { count } } }\",\n \"variables\": {\n \"productId\": \"gid://shopify/Product/108828309\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query ProductImageCount($productId: ID!) {\n product(id: $productId) {\n mediaCount {\n count\n }\n }\n }`,\n \"variables\": {\n \"productId\": \"gid://shopify/Product/108828309\"\n },\n },\n});\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 ProductImageCount($productId: ID!) {\n product(id: $productId) {\n mediaCount {\n count\n }\n }\n }\nQUERY\n\nvariables = {\n \"productId\": \"gid://shopify/Product/108828309\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query ProductImageCount($productId: ID!) {\n product(id: $productId) {\n mediaCount {\n count\n }\n }\n }\nQUERY;\n\n$variables = [\n \"productId\" => \"gid://shopify/Product/108828309\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query ProductImageCount($productId: ID!) {\n product(id: $productId) {\n mediaCount {\n count\n }\n }\n }`,\n {\n variables: {\n \"productId\": \"gid://shopify/Product/108828309\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query ProductImageCount($productId: ID!) {\n product(id: $productId) {\n mediaCount {\n count\n }\n }\n}"
input: { "productId": "gid://shopify/Product/108828309" }
response: { "data": { "product": { "mediaCount": { "count": 5 } } } }
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 ProductImageList($productId: ID!) { product(id: $productId) { media(first: 10, query: \\\"media_type:IMAGE\\\", sortKey: POSITION) { nodes { id alt ... on MediaImage { createdAt image { width height url } } } pageInfo { startCursor endCursor } } } }\",\n \"variables\": {\n \"productId\": \"gid://shopify/Product/108828309\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query ProductImageList($productId: ID!) {\n product(id: $productId) {\n media(first: 10, query: \"media_type:IMAGE\", sortKey: POSITION) {\n nodes {\n id\n alt\n ... on MediaImage {\n createdAt\n image {\n width\n height\n url\n }\n }\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n }\n }`,\n \"variables\": {\n \"productId\": \"gid://shopify/Product/108828309\"\n },\n },\n});\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 ProductImageList($productId: ID!) {\n product(id: $productId) {\n media(first: 10, query: \"media_type:IMAGE\", sortKey: POSITION) {\n nodes {\n id\n alt\n ... on MediaImage {\n createdAt\n image {\n width\n height\n url\n }\n }\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"productId\": \"gid://shopify/Product/108828309\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query ProductImageList($productId: ID!) {\n product(id: $productId) {\n media(first: 10, query: \"media_type:IMAGE\", sortKey: POSITION) {\n nodes {\n id\n alt\n ... on MediaImage {\n createdAt\n image {\n width\n height\n url\n }\n }\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"productId\" => \"gid://shopify/Product/108828309\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query ProductImageList($productId: ID!) {\n product(id: $productId) {\n media(first: 10, query: \"media_type:IMAGE\", sortKey: POSITION) {\n nodes {\n id\n alt\n ... on MediaImage {\n createdAt\n image {\n width\n height\n url\n }\n }\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n }\n }`,\n {\n variables: {\n \"productId\": \"gid://shopify/Product/108828309\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query ProductImageList($productId: ID!) {\n product(id: $productId) {\n media(first: 10, query: \"media_type:IMAGE\", sortKey: POSITION) {\n nodes {\n id\n alt\n ... on MediaImage {\n createdAt\n image {\n width\n height\n url\n }\n }\n }\n pageInfo {\n startCursor\n endCursor\n }\n }\n }\n}"
input: { "productId": "gid://shopify/Product/108828309" }
response: { "data": { "product": { "media": { "nodes": [ { "id": "gid://shopify/MediaImage/853695510", "alt": "", "createdAt": "2024-11-04T22:58:15Z", "image": { "width": 85, "height": 400, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1730761095" } }, { "id": "gid://shopify/MediaImage/603944694", "alt": "", "createdAt": "2024-11-04T22:58:15Z", "image": { "width": 85, "height": 400, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft59.jpg?v=1730761095" } } ], "pageInfo": { "startCursor": "eyJsYXN0X2lkIjo4NTM2OTU1MTAsImxhc3RfdmFsdWUiOiI0In0=", "endCursor": "eyJsYXN0X2lkIjo2MDM5NDQ2OTQsImxhc3RfdmFsdWUiOiI1In0=" } } } } }
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 GetProduct($id: ID!) { product(id: $id) { id title variants(first: 10) { nodes { id title } } collections(first: 10) { nodes { id title } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Product/108828309\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query GetProduct($id: ID!) {\n product(id: $id) {\n id\n title\n variants(first: 10) {\n nodes {\n id\n title\n }\n }\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Product/108828309\"\n },\n },\n});\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 GetProduct($id: ID!) {\n product(id: $id) {\n id\n title\n variants(first: 10) {\n nodes {\n id\n title\n }\n }\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Product/108828309\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query GetProduct($id: ID!) {\n product(id: $id) {\n id\n title\n variants(first: 10) {\n nodes {\n id\n title\n }\n }\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Product/108828309\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query GetProduct($id: ID!) {\n product(id: $id) {\n id\n title\n variants(first: 10) {\n nodes {\n id\n title\n }\n }\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Product/108828309\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query GetProduct($id: ID!) {\n product(id: $id) {\n id\n title\n variants(first: 10) {\n nodes {\n id\n title\n }\n }\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n}"
input: { "id": "gid://shopify/Product/108828309" }
response: { "data": { "product": { "id": "gid://shopify/Product/108828309", "title": "Draft", "variants": { "nodes": [ { "id": "gid://shopify/ProductVariant/43729076", "title": "151cm" } ] }, "collections": { "nodes": [ { "id": "gid://shopify/Collection/79210309", "title": "Custom Other Items" }, { "id": "gid://shopify/Collection/94229130", "title": "All products more expensive than free" }, { "id": "gid://shopify/Collection/142458073", "title": "All snowboards" }, { "id": "gid://shopify/Collection/442946009", "title": "All products - handpicked!" }, { "id": "gid://shopify/Collection/793607630", "title": "Featured items" }, { "id": "gid://shopify/Collection/925420914", "title": "All snowboards called Draft" }, { "id": "gid://shopify/Collection/1007901140", "title": "Featured items" }, { "id": "gid://shopify/Collection/1063001310", "title": "Smart Other items" } ] } } } }
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 { product(id: \\\"gid://shopify/Product/108828309\\\") { title media(first: 5) { edges { node { ...fieldsForMediaTypes } } } } } fragment fieldsForMediaTypes on Media { alt mediaContentType preview { image { id altText originalSrc } } status ... on Video { id sources { format height mimeType url width } originalSource { format height mimeType url width } } ... on ExternalVideo { id host embeddedUrl } ... on Model3d { sources { format mimeType url } originalSource { format mimeType url } } ... on MediaImage { id image { altText originalSrc } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n media(first: 5) {\n edges {\n node {\n ...fieldsForMediaTypes\n }\n }\n }\n }\n }\n \n fragment fieldsForMediaTypes on Media {\n alt\n mediaContentType\n preview {\n image {\n id\n altText\n originalSrc\n }\n }\n status\n ... on Video {\n id\n sources {\n format\n height\n mimeType\n url\n width\n }\n originalSource {\n format\n height\n mimeType\n url\n width\n }\n }\n ... on ExternalVideo {\n id\n host\n embeddedUrl\n }\n ... on Model3d {\n sources {\n format\n mimeType\n url\n }\n originalSource {\n format\n mimeType\n url\n }\n }\n ... on MediaImage {\n id\n image {\n altText\n originalSrc\n }\n }\n }`,\n});\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 product(id: \"gid://shopify/Product/108828309\") {\n title\n media(first: 5) {\n edges {\n node {\n ...fieldsForMediaTypes\n }\n }\n }\n }\n }\n \n fragment fieldsForMediaTypes on Media {\n alt\n mediaContentType\n preview {\n image {\n id\n altText\n originalSrc\n }\n }\n status\n ... on Video {\n id\n sources {\n format\n height\n mimeType\n url\n width\n }\n originalSource {\n format\n height\n mimeType\n url\n width\n }\n }\n ... on ExternalVideo {\n id\n host\n embeddedUrl\n }\n ... on Model3d {\n sources {\n format\n mimeType\n url\n }\n originalSource {\n format\n mimeType\n url\n }\n }\n ... on MediaImage {\n id\n image {\n altText\n originalSrc\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n media(first: 5) {\n edges {\n node {\n ...fieldsForMediaTypes\n }\n }\n }\n }\n }\n \n fragment fieldsForMediaTypes on Media {\n alt\n mediaContentType\n preview {\n image {\n id\n altText\n originalSrc\n }\n }\n status\n ... on Video {\n id\n sources {\n format\n height\n mimeType\n url\n width\n }\n originalSource {\n format\n height\n mimeType\n url\n width\n }\n }\n ... on ExternalVideo {\n id\n host\n embeddedUrl\n }\n ... on Model3d {\n sources {\n format\n mimeType\n url\n }\n originalSource {\n format\n mimeType\n url\n }\n }\n ... on MediaImage {\n id\n image {\n altText\n originalSrc\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n media(first: 5) {\n edges {\n node {\n ...fieldsForMediaTypes\n }\n }\n }\n }\n }\n \n fragment fieldsForMediaTypes on Media {\n alt\n mediaContentType\n preview {\n image {\n id\n altText\n originalSrc\n }\n }\n status\n ... on Video {\n id\n sources {\n format\n height\n mimeType\n url\n width\n }\n originalSource {\n format\n height\n mimeType\n url\n width\n }\n }\n ... on ExternalVideo {\n id\n host\n embeddedUrl\n }\n ... on Model3d {\n sources {\n format\n mimeType\n url\n }\n originalSource {\n format\n mimeType\n url\n }\n }\n ... on MediaImage {\n id\n image {\n altText\n originalSrc\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n product(id: \"gid://shopify/Product/108828309\") {\n title\n media(first: 5) {\n edges {\n node {\n ...fieldsForMediaTypes\n }\n }\n }\n }\n}\n\nfragment fieldsForMediaTypes on Media {\n alt\n mediaContentType\n preview {\n image {\n id\n altText\n originalSrc\n }\n }\n status\n ... on Video {\n id\n sources {\n format\n height\n mimeType\n url\n width\n }\n originalSource {\n format\n height\n mimeType\n url\n width\n }\n }\n ... on ExternalVideo {\n id\n host\n embeddedUrl\n }\n ... on Model3d {\n sources {\n format\n mimeType\n url\n }\n originalSource {\n format\n mimeType\n url\n }\n }\n ... on MediaImage {\n id\n image {\n altText\n originalSrc\n }\n }\n}"
input: null
response: { "data": { "product": { "title": "Draft", "media": { "edges": [ { "node": { "alt": "This is a video", "mediaContentType": "EXTERNAL_VIDEO", "preview": { "image": { "id": "gid://shopify/ImageSource/425689044", "altText": "This is a video", "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/external_video_preview.jpg?v=1730761095" } }, "status": "READY", "id": "gid://shopify/ExternalVideo/1041834415", "host": "YOUTUBE", "embeddedUrl": "https://youtu.be/dQw4w9WgXcQ" } }, { "node": { "alt": "This is a video", "mediaContentType": "VIDEO", "preview": { "image": { "id": "gid://shopify/ImageSource/727549632", "altText": "This is a video", "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/shopify_video_preview.jpg?v=1730761095" } }, "status": "READY", "id": "gid://shopify/Video/723685877", "sources": [ { "format": "mp4", "height": 1080, "mimeType": "video/mp4", "url": "https://cdn.shopify.com/videos/dev/vp/098dc4345e654352a24b0b033d2a3a1b/HD-1080p.mp4", "width": 1920 }, { "format": "mp4", "height": 720, "mimeType": "video/mp4", "url": "https://cdn.shopify.com/videos/dev/vp/098dc4345e654352a24b0b033d2a3a1b/HD-720p.mp4", "width": 1280 }, { "format": "m3u8", "height": 720, "mimeType": "application/x-mpegURL", "url": "https://cdn.shopify.com/videos/dev/vp/098dc4345e654352a24b0b033d2a3a1b/streaming.m3u8", "width": 1280 } ], "originalSource": { "format": "mov", "height": 360, "mimeType": "video/quicktime", "url": "https://cdn.shopify.com/videos/vp/03d15b89f02b4e1a97e9c5cd76bd0a6d/SD-360p.mov", "width": 480 } } }, { "node": { "alt": "This is a 3d Model", "mediaContentType": "MODEL_3D", "preview": { "image": { "id": "gid://shopify/ImageSource/175601098", "altText": "This is a 3d Model", "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/threed_preview_image.jpg?v=1730761095" } }, "status": "READY", "sources": [ { "format": "glb", "mimeType": "model/gltf-binary", "url": "https://storage.googleapis.com/threed-models-test/temp.glb" }, { "format": "usdz", "mimeType": "model/vnd.usdz+zip", "url": "https://storage.googleapis.com/threed-models-test/temp.usdz" } ], "originalSource": { "format": "glb", "mimeType": "model/gltf-binary", "url": "https://storage.googleapis.com/threed-models-test/temp_original.glb" } } }, { "node": { "alt": "", "mediaContentType": "IMAGE", "preview": { "image": { "id": "gid://shopify/ImageSource/853695510", "altText": "", "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1730761095" } }, "status": "READY", "id": "gid://shopify/MediaImage/853695510", "image": { "altText": "", "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1730761095" } } }, { "node": { "alt": "", "mediaContentType": "IMAGE", "preview": { "image": { "id": "gid://shopify/ImageSource/603944694", "altText": "", "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft59.jpg?v=1730761095" } }, "status": "READY", "id": "gid://shopify/MediaImage/603944694", "image": { "altText": "", "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft59.jpg?v=1730761095" } } } ] } } } }
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 CollectionsForProduct($productId: ID!) { product(id: $productId) { collections(first: 10) { nodes { id title } } } }\",\n \"variables\": {\n \"productId\": \"gid://shopify/Product/108828309\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CollectionsForProduct($productId: ID!) {\n product(id: $productId) {\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n }`,\n \"variables\": {\n \"productId\": \"gid://shopify/Product/108828309\"\n },\n },\n});\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 CollectionsForProduct($productId: ID!) {\n product(id: $productId) {\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"productId\": \"gid://shopify/Product/108828309\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query CollectionsForProduct($productId: ID!) {\n product(id: $productId) {\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"productId\" => \"gid://shopify/Product/108828309\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CollectionsForProduct($productId: ID!) {\n product(id: $productId) {\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n }`,\n {\n variables: {\n \"productId\": \"gid://shopify/Product/108828309\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CollectionsForProduct($productId: ID!) {\n product(id: $productId) {\n collections(first: 10) {\n nodes {\n id\n title\n }\n }\n }\n}"
input: { "productId": "gid://shopify/Product/108828309" }
response: { "data": { "product": { "collections": { "nodes": [ { "id": "gid://shopify/Collection/79210309", "title": "Custom Other Items" }, { "id": "gid://shopify/Collection/94229130", "title": "All products more expensive than free" }, { "id": "gid://shopify/Collection/142458073", "title": "All snowboards" }, { "id": "gid://shopify/Collection/442946009", "title": "All products - handpicked!" }, { "id": "gid://shopify/Collection/793607630", "title": "Featured items" }, { "id": "gid://shopify/Collection/925420914", "title": "All snowboards called Draft" }, { "id": "gid://shopify/Collection/1007901140", "title": "Featured items" }, { "id": "gid://shopify/Collection/1063001310", "title": "Smart Other items" } ] } } } }