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.
Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024Note: Customizing your CSS requires some familiarity with CSS and HTML. Before you cust...
By JasonH Aug 12, 2024