bad board
", "handle": "element", "productType": "Snowboards", "title": "Element", "vendor": "Arbor", "tags": [], "publishedAt": "2005-01-01T00:00:00Z", "variants": { "nodes": [ { "id": "gid://shopify/ProductVariant/30322695" }, { "id": "gid://shopify/ProductVariant/113711323" }, { "id": "gid://shopify/ProductVariant/236948360" } ] }, "images": { "nodes": [ { "id": "gid://shopify/ProductImage/916933471", "height": 400, "width": 85, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/element58.jpg?v=1773111786" }, { "id": "gid://shopify/ProductImage/671149505", "height": 110, "width": 372, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/bacon.jpg?v=1773111786" } ] } } } ``` * ### Retrieve a product using the QueryRoot.node field and a GraphQL fragment #### Description Supply the product ID to retrieve the title of the product. This example returns the product title for the specified product. #### Query ```graphql query { node(id: "gid://shopify/Product/108828309") { id ... on Product { 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 { node(id: \"gid://shopify/Product/108828309\") { id ... on Product { 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 { node(id: "gid://shopify/Product/108828309") { id ... on Product { 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 { node(id: "gid://shopify/Product/108828309") { id ... on Product { title } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title } } }`, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title } } }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ query: ` query { node(id: "gid://shopify/Product/108828309") { id ... on Product { title } } } `, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "node": { "id": "gid://shopify/Product/108828309", "title": "Draft" } } ``` * ### Retrieve a product's fields and connections #### Description Supply the product ID to retrieve the product's fields and connections. This example returns comprehensive information about the product, including its collections, created date, description, handle, and variant information. You must have the \`read\_publications\` and \`read\_product\_listings\` access scopes to return publication information. #### Query ```graphql query { product(id: "gid://shopify/Product/108828309") { collections(first: 5) { edges { node { handle } } } createdAt defaultCursor description descriptionHtml featuredMedia { id } feedback { details { messages { message } } } giftCardTemplateSuffix handle hasOnlyDefaultVariant hasOutOfStockVariants id media(first: 5) { edges { node { id } } } inCollection(id: "gid://shopify/Collection/1007901140") isGiftCard legacyResourceId metafields(first: 5) { edges { node { id } } } onlineStorePreviewUrl onlineStoreUrl options { name } priceRangeV2 { maxVariantPrice { amount } minVariantPrice { amount } } productType resourcePublicationsCount { count } availablePublicationsCount { count } publishedAt resourcePublications(first: 5) { edges { node { isPublished } } } resourcePublicationOnCurrentPublication { publication { id } publishDate isPublished } seo { title } tags templateSuffix title totalInventory tracksInventory unpublishedPublications(first: 5) { edges { node { id } } } updatedAt variants(first: 5) { edges { node { displayName } } } variantsCount { count } vendor } } ``` #### 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 { product(id: \"gid://shopify/Product/108828309\") { collections(first: 5) { edges { node { handle } } } createdAt defaultCursor description descriptionHtml featuredMedia { id } feedback { details { messages { message } } } giftCardTemplateSuffix handle hasOnlyDefaultVariant hasOutOfStockVariants id media(first: 5) { edges { node { id } } } inCollection(id: \"gid://shopify/Collection/1007901140\") isGiftCard legacyResourceId metafields(first: 5) { edges { node { id } } } onlineStorePreviewUrl onlineStoreUrl options { name } priceRangeV2 { maxVariantPrice { amount } minVariantPrice { amount } } productType resourcePublicationsCount { count } availablePublicationsCount { count } publishedAt resourcePublications(first: 5) { edges { node { isPublished } } } resourcePublicationOnCurrentPublication { publication { id } publishDate isPublished } seo { title } tags templateSuffix title totalInventory tracksInventory unpublishedPublications(first: 5) { edges { node { id } } } updatedAt variants(first: 5) { edges { node { displayName } } } variantsCount { count } vendor } }" }' ``` #### 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 { product(id: "gid://shopify/Product/108828309") { collections(first: 5) { edges { node { handle } } } createdAt defaultCursor description descriptionHtml featuredMedia { id } feedback { details { messages { message } } } giftCardTemplateSuffix handle hasOnlyDefaultVariant hasOutOfStockVariants id media(first: 5) { edges { node { id } } } inCollection(id: "gid://shopify/Collection/1007901140") isGiftCard legacyResourceId metafields(first: 5) { edges { node { id } } } onlineStorePreviewUrl onlineStoreUrl options { name } priceRangeV2 { maxVariantPrice { amount } minVariantPrice { amount } } productType resourcePublicationsCount { count } availablePublicationsCount { count } publishedAt resourcePublications(first: 5) { edges { node { isPublished } } } resourcePublicationOnCurrentPublication { publication { id } publishDate isPublished } seo { title } tags templateSuffix title totalInventory tracksInventory unpublishedPublications(first: 5) { edges { node { id } } } updatedAt variants(first: 5) { edges { node { displayName } } } variantsCount { count } vendor } }`, ); 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 { product(id: "gid://shopify/Product/108828309") { collections(first: 5) { edges { node { handle } } } createdAt defaultCursor description descriptionHtml featuredMedia { id } feedback { details { messages { message } } } giftCardTemplateSuffix handle hasOnlyDefaultVariant hasOutOfStockVariants id media(first: 5) { edges { node { id } } } inCollection(id: "gid://shopify/Collection/1007901140") isGiftCard legacyResourceId metafields(first: 5) { edges { node { id } } } onlineStorePreviewUrl onlineStoreUrl options { name } priceRangeV2 { maxVariantPrice { amount } minVariantPrice { amount } } productType resourcePublicationsCount { count } availablePublicationsCount { count } publishedAt resourcePublications(first: 5) { edges { node { isPublished } } } resourcePublicationOnCurrentPublication { publication { id } publishDate isPublished } seo { title } tags templateSuffix title totalInventory tracksInventory unpublishedPublications(first: 5) { edges { node { id } } } updatedAt variants(first: 5) { edges { node { displayName } } } variantsCount { count } vendor } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { product(id: "gid://shopify/Product/108828309") { collections(first: 5) { edges { node { handle } } } createdAt defaultCursor description descriptionHtml featuredMedia { id } feedback { details { messages { message } } } giftCardTemplateSuffix handle hasOnlyDefaultVariant hasOutOfStockVariants id media(first: 5) { edges { node { id } } } inCollection(id: "gid://shopify/Collection/1007901140") isGiftCard legacyResourceId metafields(first: 5) { edges { node { id } } } onlineStorePreviewUrl onlineStoreUrl options { name } priceRangeV2 { maxVariantPrice { amount } minVariantPrice { amount } } productType resourcePublicationsCount { count } availablePublicationsCount { count } publishedAt resourcePublications(first: 5) { edges { node { isPublished } } } resourcePublicationOnCurrentPublication { publication { id } publishDate isPublished } seo { title } tags templateSuffix title totalInventory tracksInventory unpublishedPublications(first: 5) { edges { node { id } } } updatedAt variants(first: 5) { edges { node { displayName } } } variantsCount { count } vendor } }`, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'query { product(id: "gid://shopify/Product/108828309") { collections(first: 5) { edges { node { handle } } } createdAt defaultCursor description descriptionHtml featuredMedia { id } feedback { details { messages { message } } } giftCardTemplateSuffix handle hasOnlyDefaultVariant hasOutOfStockVariants id media(first: 5) { edges { node { id } } } inCollection(id: "gid://shopify/Collection/1007901140") isGiftCard legacyResourceId metafields(first: 5) { edges { node { id } } } onlineStorePreviewUrl onlineStoreUrl options { name } priceRangeV2 { maxVariantPrice { amount } minVariantPrice { amount } } productType resourcePublicationsCount { count } availablePublicationsCount { count } publishedAt resourcePublications(first: 5) { edges { node { isPublished } } } resourcePublicationOnCurrentPublication { publication { id } publishDate isPublished } seo { title } tags templateSuffix title totalInventory tracksInventory unpublishedPublications(first: 5) { edges { node { id } } } updatedAt variants(first: 5) { edges { node { displayName } } } variantsCount { count } vendor } }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ query: ` query { product(id: "gid://shopify/Product/108828309") { collections(first: 5) { edges { node { handle } } } createdAt defaultCursor description descriptionHtml featuredMedia { id } feedback { details { messages { message } } } giftCardTemplateSuffix handle hasOnlyDefaultVariant hasOutOfStockVariants id media(first: 5) { edges { node { id } } } inCollection(id: "gid://shopify/Collection/1007901140") isGiftCard legacyResourceId metafields(first: 5) { edges { node { id } } } onlineStorePreviewUrl onlineStoreUrl options { name } priceRangeV2 { maxVariantPrice { amount } minVariantPrice { amount } } productType resourcePublicationsCount { count } availablePublicationsCount { count } publishedAt resourcePublications(first: 5) { edges { node { isPublished } } } resourcePublicationOnCurrentPublication { publication { id } publishDate isPublished } seo { title } tags templateSuffix title totalInventory tracksInventory unpublishedPublications(first: 5) { edges { node { id } } } updatedAt variants(first: 5) { edges { node { displayName } } } variantsCount { count } vendor } } `, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "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": "good board
", "featuredMedia": { "id": "gid://shopify/ExternalVideo/1041834415" }, "feedback": null, "giftCardTemplateSuffix": null, "handle": "draft", "hasOnlyDefaultVariant": false, "hasOutOfStockVariants": false, "id": "gid://shopify/Product/108828309", "media": { "edges": [ { "node": { "id": "gid://shopify/ExternalVideo/1041834415" } }, { "node": { "id": "gid://shopify/Video/723685877" } }, { "node": { "id": "gid://shopify/Model3d/544780400" } }, { "node": { "id": "gid://shopify/MediaImage/853695510" } }, { "node": { "id": "gid://shopify/MediaImage/603944694" } } ] }, "inCollection": true, "isGiftCard": false, "legacyResourceId": "108828309", "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/61655654" } }, { "node": { "id": "gid://shopify/Metafield/147010266" } }, { "node": { "id": "gid://shopify/Metafield/204658793" } }, { "node": { "id": "gid://shopify/Metafield/485513001" } }, { "node": { "id": "gid://shopify/Metafield/632448133" } } ] }, "onlineStorePreviewUrl": "https://www.snowdevil.ca/products/draft", "onlineStoreUrl": "https://www.snowdevil.ca/products/draft", "options": [ { "name": "Title" } ], "priceRangeV2": { "maxVariantPrice": { "amount": "10.0" }, "minVariantPrice": { "amount": "10.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": { "id": "gid://shopify/Publication/762454635" }, "publishDate": "2005-01-02T00:00:00Z", "isPublished": true }, "seo": { "title": null }, "tags": [ "Deepsnow", "Dub Quote\"s", "quote's", "Wooden Core" ], "templateSuffix": null, "title": "Draft", "totalInventory": 1, "tracksInventory": true, "unpublishedPublications": { "edges": [ { "node": { "id": "gid://shopify/Publication/49361227" } }, { "node": { "id": "gid://shopify/Publication/195806409" } }, { "node": { "id": "gid://shopify/Publication/224761294" } }, { "node": { "id": "gid://shopify/Publication/336184109" } }, { "node": { "id": "gid://shopify/Publication/347532733" } } ] }, "updatedAt": "2005-01-02T00:00:00Z", "variants": { "edges": [ { "node": { "displayName": "Draft - 151cm" } } ] }, "variantsCount": { "count": 1 }, "vendor": "Arbor" } } ``` * ### Retrieve a single product #### Description Supply the product ID to retrieve the product. This example returns the product's ID, title, \[product variants]\(https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductVariant), and \[collections]\(https://shopify.dev/docs/api/admin-graphql/latest/objects/Collection). #### Query ```graphql query GetProduct($id: ID!) { product(id: $id) { id title variants(first: 10) { nodes { id title } } collections(first: 10) { nodes { id title } } } } ``` #### Variables ```json { "id": "gid://shopify/Product/108828309" } ``` #### 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 GetProduct($id: ID!) { product(id: $id) { id title variants(first: 10) { nodes { id title } } collections(first: 10) { nodes { id title } } } }", "variables": { "id": "gid://shopify/Product/108828309" } }' ``` #### 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 GetProduct($id: ID!) { product(id: $id) { id title variants(first: 10) { nodes { id title } } collections(first: 10) { nodes { id title } } } }`, { variables: { "id": "gid://shopify/Product/108828309" }, }, ); 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 GetProduct($id: ID!) { product(id: $id) { id title variants(first: 10) { nodes { id title } } collections(first: 10) { nodes { id title } } } } QUERY variables = { "id": "gid://shopify/Product/108828309" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query GetProduct($id: ID!) { product(id: $id) { id title variants(first: 10) { nodes { id title } } collections(first: 10) { nodes { id title } } } }`, "variables": { "id": "gid://shopify/Product/108828309" }, }, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'query GetProduct($id: ID!) { product(id: $id) { id title variants(first: 10) { nodes { id title } } collections(first: 10) { nodes { id title } } } }' \ --variables \ '{ "id": "gid://shopify/Product/108828309" }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ query: ` query GetProduct($id: ID!) { product(id: $id) { id title variants(first: 10) { nodes { id title } } collections(first: 10) { nodes { id title } } } } `, variables: { "id": "gid://shopify/Product/108828309" }, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "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" } ] } } } ``` * ### Retrieve media for a product #### Description Supply the product ID to retrieve the media, such as images and videos, for the product. This example returns the media for the specified product. Learn more about \[managing media for products]\(https://shopify.dev/docs/apps/build/online-store/product-media). #### Query ```graphql query { product(id: "gid://shopify/Product/108828309") { title media(first: 5) { edges { node { ...fieldsForMediaTypes } } } } } fragment fieldsForMediaTypes on Media { alt mediaContentType preview { image { id altText url } } status ... on Video { id sources { format height mimeType url width } originalSource { format height mimeType url width } } ... on ExternalVideo { id host originUrl } ... on Model3d { sources { format mimeType url } originalSource { format mimeType url } } ... on MediaImage { id image { altText url } } } ``` #### 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 { product(id: \"gid://shopify/Product/108828309\") { title media(first: 5) { edges { node { ...fieldsForMediaTypes } } } } } fragment fieldsForMediaTypes on Media { alt mediaContentType preview { image { id altText url } } status ... on Video { id sources { format height mimeType url width } originalSource { format height mimeType url width } } ... on ExternalVideo { id host originUrl } ... on Model3d { sources { format mimeType url } originalSource { format mimeType url } } ... on MediaImage { id image { altText url } } }" }' ``` #### 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 { product(id: "gid://shopify/Product/108828309") { title media(first: 5) { edges { node { ...fieldsForMediaTypes } } } } } fragment fieldsForMediaTypes on Media { alt mediaContentType preview { image { id altText url } } status ... on Video { id sources { format height mimeType url width } originalSource { format height mimeType url width } } ... on ExternalVideo { id host originUrl } ... on Model3d { sources { format mimeType url } originalSource { format mimeType url } } ... on MediaImage { id image { altText url } } }`, ); 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 { product(id: "gid://shopify/Product/108828309") { title media(first: 5) { edges { node { ...fieldsForMediaTypes } } } } } fragment fieldsForMediaTypes on Media { alt mediaContentType preview { image { id altText url } } status ... on Video { id sources { format height mimeType url width } originalSource { format height mimeType url width } } ... on ExternalVideo { id host originUrl } ... on Model3d { sources { format mimeType url } originalSource { format mimeType url } } ... on MediaImage { id image { altText url } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { product(id: "gid://shopify/Product/108828309") { title media(first: 5) { edges { node { ...fieldsForMediaTypes } } } } } fragment fieldsForMediaTypes on Media { alt mediaContentType preview { image { id altText url } } status ... on Video { id sources { format height mimeType url width } originalSource { format height mimeType url width } } ... on ExternalVideo { id host originUrl } ... on Model3d { sources { format mimeType url } originalSource { format mimeType url } } ... on MediaImage { id image { altText url } } }`, }); ``` #### Shopify CLI ```bash shopify app execute \ --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 url } } status ... on Video { id sources { format height mimeType url width } originalSource { format height mimeType url width } } ... on ExternalVideo { id host originUrl } ... on Model3d { sources { format mimeType url } originalSource { format mimeType url } } ... on MediaImage { id image { altText url } } }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ 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 url } } status ... on Video { id sources { format height mimeType url width } originalSource { format height mimeType url width } } ... on ExternalVideo { id host originUrl } ... on Model3d { sources { format mimeType url } originalSource { format mimeType url } } ... on MediaImage { id image { altText url } } } `, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "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", "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/external_video_preview.jpg?v=1773111786" } }, "status": "READY", "id": "gid://shopify/ExternalVideo/1041834415", "host": "YOUTUBE", "originUrl": "https://youtu.be/dQw4w9WgXcQ" } }, { "node": { "alt": "This is a video", "mediaContentType": "VIDEO", "preview": { "image": { "id": "gid://shopify/ImageSource/727549632", "altText": "This is a video", "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/shopify_video_preview.jpg?v=1773111786" } }, "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", "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/threed_preview_image.jpg?v=1773111786" } }, "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": "", "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1773111786" } }, "status": "READY", "id": "gid://shopify/MediaImage/853695510", "image": { "altText": "", "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1773111786" } } }, { "node": { "alt": "", "mediaContentType": "IMAGE", "preview": { "image": { "id": "gid://shopify/ImageSource/603944694", "altText": "", "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft59.jpg?v=1773111786" } }, "status": "READY", "id": "gid://shopify/MediaImage/603944694", "image": { "altText": "", "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft59.jpg?v=1773111786" } } } ] } } } ``` * ### Retrieve the first ten collections for a product #### Description Supply the product ID to retrieve the \[collections]\(https://shopify.dev/docs/api/admin-graphql/latest/objects/Collection) for the product. This example returns the first ten collections for the specified product. #### Query ```graphql query CollectionsForProduct($productId: ID!) { product(id: $productId) { collections(first: 10) { nodes { id title } } } } ``` #### Variables ```json { "productId": "gid://shopify/Product/108828309" } ``` #### 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 CollectionsForProduct($productId: ID!) { product(id: $productId) { collections(first: 10) { nodes { id title } } } }", "variables": { "productId": "gid://shopify/Product/108828309" } }' ``` #### 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 CollectionsForProduct($productId: ID!) { product(id: $productId) { collections(first: 10) { nodes { id title } } } }`, { variables: { "productId": "gid://shopify/Product/108828309" }, }, ); 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 CollectionsForProduct($productId: ID!) { product(id: $productId) { collections(first: 10) { nodes { id title } } } } QUERY variables = { "productId": "gid://shopify/Product/108828309" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query CollectionsForProduct($productId: ID!) { product(id: $productId) { collections(first: 10) { nodes { id title } } } }`, "variables": { "productId": "gid://shopify/Product/108828309" }, }, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'query CollectionsForProduct($productId: ID!) { product(id: $productId) { collections(first: 10) { nodes { id title } } } }' \ --variables \ '{ "productId": "gid://shopify/Product/108828309" }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ query: ` query CollectionsForProduct($productId: ID!) { product(id: $productId) { collections(first: 10) { nodes { id title } } } } `, variables: { "productId": "gid://shopify/Product/108828309" }, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "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" } ] } } } ``` * ### Retrieve the first ten images for a product #### Description This example demonstrates how to retrieve a product's images with \[pagination]\(https://shopify.dev/docs/api/usage/pagination-graphql), returning the first ten images. Learn more about \[managing media for products]\(https://shopify.dev/docs/apps/build/online-store/product-media). #### Query ```graphql 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 } } } } ``` #### Variables ```json { "productId": "gid://shopify/Product/108828309" } ``` #### 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 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 } } } }", "variables": { "productId": "gid://shopify/Product/108828309" } }' ``` #### 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 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 } } } }`, { variables: { "productId": "gid://shopify/Product/108828309" }, }, ); 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 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 } } } } QUERY variables = { "productId": "gid://shopify/Product/108828309" } response = client.query(query: query, variables: variables) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "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 } } } }`, "variables": { "productId": "gid://shopify/Product/108828309" }, }, }); ``` #### Shopify CLI ```bash shopify app execute \ --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 } } } }' \ --variables \ '{ "productId": "gid://shopify/Product/108828309" }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ 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 } } } } `, variables: { "productId": "gid://shopify/Product/108828309" }, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "product": { "media": { "nodes": [ { "id": "gid://shopify/MediaImage/853695510", "alt": "", "createdAt": "2026-03-10T03:03:06Z", "image": { "width": 85, "height": 400, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1773111786" } }, { "id": "gid://shopify/MediaImage/603944694", "alt": "", "createdAt": "2026-03-10T03:03:06Z", "image": { "width": 85, "height": 400, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft59.jpg?v=1773111786" } } ], "pageInfo": { "startCursor": "eyJsYXN0X2lkIjo4NTM2OTU1MTAsImxhc3RfdmFsdWUiOiI0In0=", "endCursor": "eyJsYXN0X2lkIjo2MDM5NDQ2OTQsImxhc3RfdmFsdWUiOiI1In0=" } } } } ``` * ### Retrieve the title, description, and online store URL of a product #### Description Supply the product ID to retrieve the title, description, and online store URL of the product. This example returns the title, description, and online store URL for the specified product. #### Query ```graphql query { product(id: "gid://shopify/Product/108828309") { title description onlineStoreUrl } } ``` #### 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 { product(id: \"gid://shopify/Product/108828309\") { title description onlineStoreUrl } }" }' ``` #### 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 { product(id: "gid://shopify/Product/108828309") { title description onlineStoreUrl } }`, ); 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 { product(id: "gid://shopify/Product/108828309") { title description onlineStoreUrl } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { product(id: "gid://shopify/Product/108828309") { title description onlineStoreUrl } }`, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'query { product(id: "gid://shopify/Product/108828309") { title description onlineStoreUrl } }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ query: ` query { product(id: "gid://shopify/Product/108828309") { title description onlineStoreUrl } } `, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "product": { "title": "Draft", "description": "good board", "onlineStoreUrl": "https://www.snowdevil.ca/products/draft" } } ``` * ### Retrieve the total count of inventory in stock of a product #### Description Supply the product ID to retrieve the total count of inventory in stock of the product. This example returns the product title and total inventory count for the specified product. #### Query ```graphql query { product(id: "gid://shopify/Product/108828309") { title totalInventory } } ``` #### 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 { product(id: \"gid://shopify/Product/108828309\") { title totalInventory } }" }' ``` #### 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 { product(id: "gid://shopify/Product/108828309") { title totalInventory } }`, ); 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 { product(id: "gid://shopify/Product/108828309") { title totalInventory } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `query { product(id: "gid://shopify/Product/108828309") { title totalInventory } }`, }); ``` #### Shopify CLI ```bash shopify app execute \ --query \ 'query { product(id: "gid://shopify/Product/108828309") { title totalInventory } }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ query: ` query { product(id: "gid://shopify/Product/108828309") { title totalInventory } } `, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "product": { "title": "Draft", "totalInventory": 1 } } ``` * ### Retrieve translations and localizations of a product's title and description #### Description Retrieve a product's title and description with translations (per-language overrides) and localizations (per-language, per-market overrides). This query returns the base title and description in HTML format, along with French translations and localizations. Translations and localizations are exposed separately, but the content that's actually surfaced in a particular context falls back to translations when a value isn't localized, and to the base language when a value isn't translated. Learn more about \[localizing your app]\(https://shopify.dev/docs/apps/build/localize-your-app). #### Query ```graphql 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 } } } ``` #### 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 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 } } }" }' ``` #### 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 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 } } }`, ); 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 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 } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `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 } } }`, }); ``` #### Shopify CLI ```bash shopify app execute \ --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 } } }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ 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 } } } `, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "product": { "title": "Wool sweater", "descriptionHtml": "It is very warm!
", "translations": [ { "key": "body_html", "value": "C’est très chaud!
" }, { "key": "title", "value": "Pull en laine" } ], "localizations": [ { "key": "title", "value": "Chandail en laine" } ] } } ``` * ### Retrieve variants for a product #### Description Supply the product ID to retrieve the variants for the product. This example returns the variants and media for the specified product. Learn more about \[managing media for product variants]\(https://shopify.dev/docs/apps/build/online-store/product-variant-media). #### Query ```graphql 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 } } } } } } } } } ``` #### 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 { 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 } } } } } } } } }" }' ``` #### 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 { 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 } } } } } } } } }`, ); 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 { 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 } } } } } } } } } QUERY response = client.query(query: query) ``` #### Node.js ```javascript const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: `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 } } } } } } } } }`, }); ``` #### Shopify CLI ```bash shopify app execute \ --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 } } } } } } } } }' ``` #### Direct API Access ```javascript const response = await fetch('shopify:admin/api/2026-01/graphql.json', { method: 'POST', body: JSON.stringify({ 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 } } } } } } } } } `, }), }); const { data } = await response.json(); console.log(data); ``` #### Response ```json { "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=1773111786" } } } } ] } } } ] } } } ```