# product - admin-graphql - QUERY Version: 2025-01 ## Description Returns a Product resource by ID. ### Access Scopes ## Arguments * [id](/docs/api/admin-graphql/2025-01/scalars/ID): ID! - The ID of the `Product` to return. ## Returns * [availablePublicationsCount](/docs/api/admin-graphql/2025-01/objects/Count): Count The number of [publications](https://shopify.dev/docs/api/admin-graphql/latest/objects/Publication) that a resource is published to, without [feedback errors](https://shopify.dev/docs/api/admin-graphql/latest/objects/ResourceFeedback). * [bodyHtml](/docs/api/admin-graphql/2025-01/scalars/String): String The description of the product, with HTML tags. For example, the description might include bold `` and italic `` text. * [category](/docs/api/admin-graphql/2025-01/objects/TaxonomyCategory): TaxonomyCategory The category of a product from [Shopify's Standard Product Taxonomy](https://shopify.github.io/product-taxonomy/releases/unstable/?categoryId=sg-4-17-2-17). * [combinedListing](/docs/api/admin-graphql/2025-01/objects/CombinedListing): CombinedListing A special product type that combines separate products from a store into a single product listing. [Combined listings](https://shopify.dev/apps/build/product-merchandising/combined-listings) are connected by a shared option, such as color, model, or dimension. * [combinedListingRole](/docs/api/admin-graphql/2025-01/enums/CombinedListingsRole): CombinedListingsRole The [role of the product](https://shopify.dev/docs/apps/build/product-merchandising/combined-listings/build-for-combined-listings) in a combined listing. If `null`, then the product isn't part of any combined listing. * [compareAtPriceRange](/docs/api/admin-graphql/2025-01/objects/ProductCompareAtPriceRange): ProductCompareAtPriceRange The [compare-at price range](https://help.shopify.com/manual/products/details/product-pricing/sale-pricing) of the product in the shop's default currency. * [contextualPricing](/docs/api/admin-graphql/2025-01/objects/ProductContextualPricing): ProductContextualPricing! The pricing that applies to a customer in a specific context. For example, a price might vary depending on the customer's location. * [createdAt](/docs/api/admin-graphql/2025-01/scalars/DateTime): DateTime! The date and time when the product was created. * [customProductType](/docs/api/admin-graphql/2025-01/scalars/String): String The custom product type specified by the merchant. * [defaultCursor](/docs/api/admin-graphql/2025-01/scalars/String): String! A default [cursor](https://shopify.dev/api/usage/pagination-graphql) that returns the single next record, sorted ascending by ID. * [description](/docs/api/admin-graphql/2025-01/scalars/String): String! A single-line description of the product, with [HTML tags](https://developer.mozilla.org/en-US/docs/Web/HTML) removed. * [descriptionHtml](/docs/api/admin-graphql/2025-01/scalars/HTML): HTML! The description of the product, with HTML tags. For example, the description might include bold `` and italic `` text. * [descriptionPlainSummary](/docs/api/admin-graphql/2025-01/scalars/String): String! Stripped description of the product, single line with HTML tags removed. Truncated to 60 characters. * [featuredImage](/docs/api/admin-graphql/2025-01/objects/Image): Image The featured image for the product. * [featuredMedia](/docs/api/admin-graphql/2025-01/interfaces/Media): Media The featured [media](https://shopify.dev/docs/apps/build/online-store/product-media) associated with the product. * [feedback](/docs/api/admin-graphql/2025-01/objects/ResourceFeedback): ResourceFeedback The information that lets merchants know what steps they need to take to make sure that the app is set up correctly. For example, if a merchant hasn't set up a product correctly in the app, then the feedback might include a message that says "You need to add a price to this product". * [giftCardTemplateSuffix](/docs/api/admin-graphql/2025-01/scalars/String): String The [theme template](https://shopify.dev/docs/storefronts/themes/architecture/templates) that's used when customers view the gift card in a store. * [handle](/docs/api/admin-graphql/2025-01/scalars/String): String! A unique, human-readable string of the product's title. A handle can contain letters, hyphens (`-`), and numbers, but no spaces. The handle is used in the online store URL for the product. * [hasOnlyDefaultVariant](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the product has only a single variant with the default option and value. * [hasOutOfStockVariants](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the product has variants that are out of stock. * [hasVariantsThatRequiresComponents](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether at least one of the product variants requires [bundle components](https://shopify.dev/docs/apps/build/product-merchandising/bundles/add-product-fixed-bundle). Learn more about [store eligibility for bundles](https://shopify.dev/docs/apps/build/product-merchandising/bundles#store-eligibility). * [id](/docs/api/admin-graphql/2025-01/scalars/ID): ID! A globally-unique ID. * [inCollection](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the product is in a specified [collection](https://shopify.dev/docs/api/admin-graphql/latest/objects/collection). * [isGiftCard](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the product is a gift card. * [legacyResourceId](/docs/api/admin-graphql/2025-01/scalars/UnsignedInt64): UnsignedInt64! The ID of the corresponding resource in the REST Admin API. * [mediaCount](/docs/api/admin-graphql/2025-01/objects/Count): Count The total count of [media](https://shopify.dev/docs/apps/build/online-store/product-media) that's associated with a product. * [metafield](/docs/api/admin-graphql/2025-01/objects/Metafield): Metafield A [custom field](https://shopify.dev/docs/apps/build/custom-data), including its `namespace` and `key`, that's associated with a Shopify resource for the purposes of adding and storing additional information. * [onlineStorePreviewUrl](/docs/api/admin-graphql/2025-01/scalars/URL): URL The [preview URL](https://help.shopify.com/manual/online-store/setting-up#preview-your-store) for the online store. * [onlineStoreUrl](/docs/api/admin-graphql/2025-01/scalars/URL): URL The product's URL on the online store. If `null`, then the product isn't published to the online store sales channel. * [options](/docs/api/admin-graphql/2025-01/objects/ProductOption): ProductOption! A list of product options. The limit is defined by the [shop's resource limits for product options](https://shopify.dev/docs/api/admin-graphql/latest/objects/Shop#field-resourcelimits) (`Shop.resourceLimits.maxProductOptions`). * [priceRange](/docs/api/admin-graphql/2025-01/objects/ProductPriceRange): ProductPriceRange! The price range of the product. * [priceRangeV2](/docs/api/admin-graphql/2025-01/objects/ProductPriceRangeV2): ProductPriceRangeV2! The minimum and maximum prices of a product, expressed in decimal numbers. For example, if the product is priced between $10.00 and $50.00, then the price range is $10.00 - $50.00. * [productCategory](/docs/api/admin-graphql/2025-01/objects/ProductCategory): ProductCategory The product category specified by the merchant. * [productType](/docs/api/admin-graphql/2025-01/scalars/String): String! The [product type](https://help.shopify.com/manual/products/details/product-type) that merchants define. * [publicationCount](/docs/api/admin-graphql/2025-01/scalars/Int): Int! The number of [publications](https://shopify.dev/docs/api/admin-graphql/latest/objects/Publication) that a resource is published to, without [feedback errors](https://shopify.dev/docs/api/admin-graphql/latest/objects/ResourceFeedback). * [publishedAt](/docs/api/admin-graphql/2025-01/scalars/DateTime): DateTime The date and time when the product was published to the online store. * [publishedInContext](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the product is published for a customer only in a specified context. For example, a product might be published for a customer only in a specific location. * [publishedOnChannel](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the resource is published to a specific channel. * [publishedOnCurrentChannel](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the resource is published to a [channel](https://shopify.dev/docs/api/admin-graphql/latest/objects/Channel). For example, the resource might be published to the online store channel. * [publishedOnCurrentPublication](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the resource is published to the app's [publication](https://shopify.dev/docs/api/admin-graphql/latest/objects/Publication). For example, the resource might be published to the app's online store channel. * [publishedOnPublication](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the resource is published to a specified [publication](https://shopify.dev/docs/api/admin-graphql/latest/objects/Publication). * [requiresSellingPlan](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether the product can only be purchased with a [selling plan](https://shopify.dev/docs/apps/build/purchase-options/subscriptions/selling-plans). Products that are sold on subscription (`requiresSellingPlan: true`) can be updated only for online stores. If you update a product to be subscription-only (`requiresSellingPlan:false`), then the product is unpublished from all channels, except the online store. * [resourcePublicationOnCurrentPublication](/docs/api/admin-graphql/2025-01/objects/ResourcePublicationV2): ResourcePublicationV2 The resource that's either published or staged to be published to the [publication](https://shopify.dev/docs/api/admin-graphql/latest/objects/Publication). * [resourcePublicationsCount](/docs/api/admin-graphql/2025-01/objects/Count): Count The number of [publications](https://shopify.dev/docs/api/admin-graphql/latest/objects/Publication) that a resource is published to, without [feedback errors](https://shopify.dev/docs/api/admin-graphql/latest/objects/ResourceFeedback). * [restrictedForResource](/docs/api/admin-graphql/2025-01/objects/RestrictedForResource): RestrictedForResource Whether the merchant can make changes to the product when they [edit the order](https://shopify.dev/docs/apps/build/orders-fulfillment/order-management-apps/edit-orders) associated with the product. For example, a merchant might be restricted from changing product details when they edit an order. * [sellingPlanGroupCount](/docs/api/admin-graphql/2025-01/scalars/Int): Int! A count of [selling plan groups](https://shopify.dev/docs/apps/build/purchase-options/subscriptions/selling-plans/build-a-selling-plan) that are associated with the product. * [sellingPlanGroupsCount](/docs/api/admin-graphql/2025-01/objects/Count): Count A count of [selling plan groups](https://shopify.dev/docs/apps/build/purchase-options/subscriptions/selling-plans/build-a-selling-plan) that are associated with the product. * [seo](/docs/api/admin-graphql/2025-01/objects/SEO): SEO! The [SEO title and description](https://help.shopify.com/manual/promoting-marketing/seo/adding-keywords) that are associated with a product. * [standardizedProductType](/docs/api/admin-graphql/2025-01/objects/StandardizedProductType): StandardizedProductType The standardized product type in the Shopify product taxonomy. * [status](/docs/api/admin-graphql/2025-01/enums/ProductStatus): ProductStatus! The [product status](https://help.shopify.com/manual/products/details/product-details-page#product-status), which controls visibility across all sales channels. * [storefrontId](/docs/api/admin-graphql/2025-01/scalars/StorefrontID): StorefrontID! The Storefront GraphQL API ID of the `Product`. As of the `2022-04` version release, the Storefront GraphQL API will no longer return Base64 encoded IDs to match the behavior of the Admin GraphQL API. Therefore, you can safely use the `id` field's value instead. * [tags](/docs/api/admin-graphql/2025-01/scalars/String): String! A comma-separated list of searchable keywords that are associated with the product. For example, a merchant might apply the `sports` and `summer` tags to products that are associated with sportwear for summer. Updating `tags` overwrites any existing tags that were previously added to the product. To add new tags without overwriting existing tags, use the [`tagsAdd`](https://shopify.dev/api/admin-graphql/latest/mutations/tagsadd) mutation. * [templateSuffix](/docs/api/admin-graphql/2025-01/scalars/String): String The [theme template](https://shopify.dev/docs/storefronts/themes/architecture/templates) that's used when customers view the product in a store. * [title](/docs/api/admin-graphql/2025-01/scalars/String): String! The name for the product that displays to customers. The title is used to construct the product's handle. For example, if a product is titled "Black Sunglasses", then the handle is `black-sunglasses`. * [totalInventory](/docs/api/admin-graphql/2025-01/scalars/Int): Int! The quantity of inventory that's in stock. * [totalVariants](/docs/api/admin-graphql/2025-01/scalars/Int): Int! The number of [variants](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductVariant) that are associated with the product. * [tracksInventory](/docs/api/admin-graphql/2025-01/scalars/Boolean): Boolean! Whether [inventory tracking](https://help.shopify.com/manual/products/inventory/getting-started-with-inventory/set-up-inventory-tracking) has been enabled for the product. * [translations](/docs/api/admin-graphql/2025-01/objects/Translation): Translation! The published translations associated with the resource. * [updatedAt](/docs/api/admin-graphql/2025-01/scalars/DateTime): DateTime! The date and time when the product was last modified. A product's `updatedAt` value can change for different reasons. For example, if an order is placed for a product that has inventory tracking set up, then the inventory adjustment is counted as an update. * [variantsCount](/docs/api/admin-graphql/2025-01/objects/Count): Count The number of [variants](https://shopify.dev/docs/api/admin-graphql/latest/objects/ProductVariant) that are associated with the product. * [vendor](/docs/api/admin-graphql/2025-01/scalars/String): String! The name of the product's vendor. ## Examples ### Get a metafield attached to a product Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input { "namespace": "my_fields", "key": "liner_material", "ownerId": "gid://shopify/Product/108828309" } #### Graphql Response { "data": { "product": { "linerMaterial": { "value": "synthetic leather" } } } } ### Get a product using the QueryRoot.node field and a GraphQL fragment Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql Response { "data": { "node": { "id": "gid://shopify/Product/108828309", "title": "Draft" } } } ### Get all a product's fields and connections Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql 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": "

good board

", "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" } } } ### Get metafields attached to a product Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input { "ownerId": "gid://shopify/Product/108828309" } #### Graphql Response { "data": { "product": { "metafields": { "edges": [ { "node": { "namespace": "my_fields", "key": "liner_material", "value": "synthetic leather" } } ] } } } } ### Get pinned metafield definitions associated with a product Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Product/108828309", "first": 10, "sortKey": "PINNED_POSITION" } #### Graphql 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" } } } ] } } } } ### Get the price range for a product for buyers from Canada Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql Response { "data": { "product": { "contextualPricing": { "priceRange": { "maxVariantPrice": { "amount": "12.99", "currencyCode": "CAD" }, "minVariantPrice": { "amount": "12.99", "currencyCode": "CAD" } } } } } } ### Get the title, description and online store URL of a product Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql Response { "data": { "product": { "title": "Draft", "description": "good board", "onlineStoreUrl": "https://www.snowdevil.ca/products/draft" } } } ### Get the total count of inventory in stock of a product Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql Response { "data": { "product": { "title": "Draft", "totalInventory": 1 } } } ### Loading translations and localizations of a product's title and description Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql Response { "data": { "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" } ] } } } ### Query a product and display its variants Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql 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=1733171181" } } } } ] } } } ] } } } } ### Query whether a product is published in a given country Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql Response { "data": { "product": { "title": "Alarm clock", "publishedInCA": true, "publishedInGB": false, "publishedInUS": true } } } ### Receive a count of all Product Images Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input { "productId": "gid://shopify/Product/108828309" } #### Graphql Response { "data": { "product": { "mediaCount": { "count": 5 } } } } ### Receive a list of all Product Images Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input { "productId": "gid://shopify/Product/108828309" } #### Graphql Response { "data": { "product": { "media": { "nodes": [ { "id": "gid://shopify/MediaImage/853695510", "alt": "", "createdAt": "2024-12-02T20:26:21Z", "image": { "width": 85, "height": 400, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1733171181" } }, { "id": "gid://shopify/MediaImage/603944694", "alt": "", "createdAt": "2024-12-02T20:26:21Z", "image": { "width": 85, "height": 400, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft59.jpg?v=1733171181" } } ], "pageInfo": { "startCursor": "eyJsYXN0X2lkIjo4NTM2OTU1MTAsImxhc3RfdmFsdWUiOiI0In0=", "endCursor": "eyJsYXN0X2lkIjo2MDM5NDQ2OTQsImxhc3RfdmFsdWUiOiI1In0=" } } } } } ### Retrieve a single product Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input { "id": "gid://shopify/Product/108828309" } #### Graphql 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" } ] } } } } ### Retrieve a specific product listing that is published to your app Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query ProductShow($id: ID!) { product(id: $id) { publishedOnCurrentPublication id createdAt updatedAt descriptionHtml handle productType title vendor tags publishedAt variants(first: 10) { nodes { id } } images(first: 10) { nodes { id height width url } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Product/20995642\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query ProductShow($id: ID!) {\n product(id: $id) {\n publishedOnCurrentPublication\n id\n createdAt\n updatedAt\n descriptionHtml\n handle\n productType\n title\n vendor\n tags\n publishedAt\n variants(first: 10) {\n nodes {\n id\n }\n }\n images(first: 10) {\n nodes {\n id\n height\n width\n url\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Product/20995642\"\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 ProductShow($id: ID!) {\n product(id: $id) {\n publishedOnCurrentPublication\n id\n createdAt\n updatedAt\n descriptionHtml\n handle\n productType\n title\n vendor\n tags\n publishedAt\n variants(first: 10) {\n nodes {\n id\n }\n }\n images(first: 10) {\n nodes {\n id\n height\n width\n url\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Product/20995642\"\n}\n\nresponse = 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 ProductShow($id: ID!) {\n product(id: $id) {\n publishedOnCurrentPublication\n id\n createdAt\n updatedAt\n descriptionHtml\n handle\n productType\n title\n vendor\n tags\n publishedAt\n variants(first: 10) {\n nodes {\n id\n }\n }\n images(first: 10) {\n nodes {\n id\n height\n width\n url\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Product/20995642\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query ProductShow($id: ID!) {\n product(id: $id) {\n publishedOnCurrentPublication\n id\n createdAt\n updatedAt\n descriptionHtml\n handle\n productType\n title\n vendor\n tags\n publishedAt\n variants(first: 10) {\n nodes {\n id\n }\n }\n images(first: 10) {\n nodes {\n id\n height\n width\n url\n }\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/Product/20995642" } #### Graphql Response { "data": { "product": { "publishedOnCurrentPublication": true, "id": "gid://shopify/Product/20995642", "createdAt": "2005-01-01T00:00:00Z", "updatedAt": "2005-01-01T00:00:00Z", "descriptionHtml": "

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=1733171181" }, { "id": "gid://shopify/ProductImage/671149505", "height": 110, "width": 372, "url": "https://cdn.shopify.com/s/files/1/2637/1970/products/bacon.jpg?v=1733171181" } ] } } } } ### Retrieve media objects Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input null #### Graphql 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=1733171181" } }, "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=1733171181" } }, "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=1733171181" } }, "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=1733171181" } }, "status": "READY", "id": "gid://shopify/MediaImage/853695510", "image": { "altText": "", "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft58.jpg?v=1733171181" } } }, { "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=1733171181" } }, "status": "READY", "id": "gid://shopify/MediaImage/603944694", "image": { "altText": "", "originalSrc": "https://cdn.shopify.com/s/files/1/2637/1970/products/draft59.jpg?v=1733171181" } } } ] } } } } ### Retrieves a list of collects Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/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" 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}" #### Graphql Input { "productId": "gid://shopify/Product/108828309" } #### Graphql 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" } ] } } } }