App reviews, troubleshooting, and recommendations
Hello everyone,
I'm trying to query image information using the GraphQL `products` API. One important field I need is the position of the image on the product detail page. Here is my current query:
query { products(first:10 reverse:true) { edges { node { id title status vendor featuredImage { id } category { name } handle images(first: 24) { edges { node { id url height width altText } } } variants(first:24) { edges { node { sku, image { id altText url height width } } } } } } pageInfo { hasNextPage endCursor hasPreviousPage startCursor } } }
However, I am unsure how to retrieve the position of each image on the product detail page using this query. This field is available in the REST API, but calling the REST API returns the following deprecation warning:
```
[shopify-api/WARNING] API Deprecation Notice 2024/5/16 10:03:01 : {"message":"https://shopify.dev/api/admin-rest/latest/resources/product","path":"products.json"} - Stack Trace: Error
```
Since the REST API is being deprecated, I am trying to obtain all the necessary fields from the GraphQL `products` API.
Does anyone have any suggestions or solutions for this issue? Thank you very much!
Yes, I found the solution. I discovered that the default sorting for media is based on position, with the retrieved images arranged from the first to the last. If you want to know the position, you just need to use a for loop to calculate it: position = i + 1.
June brought summer energy to our community. Members jumped in with solutions, clicked ...
By JasonH Jun 5, 2025Learn how to build powerful custom workflows in Shopify Flow with expert guidance from ...
By Jacqui May 7, 2025Did You Know? May is named after Maia, the Roman goddess of growth and flourishing! ...
By JasonH May 2, 2025