How to Get Image Position from GraphQL Products API

huangcong12
Shopify Partner
8 0 0

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!

ImgCraft: AI Sharp & Resize - Rescuing Low-Quality Images | LitaCat: Page Watermark - Convey Your Voice
Replies 0 (0)