How to get product image position with GraphQL

Highlighted
Excursionist
18 3 2

Hi,
The problem when I trying to fetch product images with GraphQL, there is no position field.

Although, in REST Api it's exists - see the link

 

{
  products(first: 10) {
    edges {
      node {
        images(first: 10) {
          edges {
            node {
              id
            }
          }
        }
      }
    }
  }
}

I can add sorting with sortKey: POSITION, but still, I don't know image position.

How to find product image position with GraphQL ?

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 124

Hi @Peter_P ,

 

As it currently stands the 'Image' resource in the Products object does not have a "position" field.

 

However, currently in developer preview there is a new ProductMedia resource with the GraphQL Admin API that does seem to have a "position field". Feel free to read this doc about it for more details: https://shopify.dev/tutorials/manage-product-media-with-admin-api

 

While this resource is not publicly available to all Shopify merchants and partners as of yet, it is coming soon. In the mean time you can access it by making a development store and enabling developer preview: https://help.shopify.com/en/partners/dashboard/managing-stores/development-stores#developer-previews

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Tourist
6 0 3

Does GraphQL return Media items in the correct "position" when requesting them?

I am using the latest 2020-07 version and the "ProductMedia" type is not valid option. What is the time frame for this feature?

0 Likes