Bulk operation fetching multiple product images despite specifying to get only the first one.

Bulk operation fetching multiple product images despite specifying to get only the first one.

nahid
Shopify Partner
5 0 0

Hello Shopify Geek,

I recently created a bulk operation where I specified that I want to fetch only the first product image. However, after the bulk operation finished and I fetched the data, I noticed that I am getting multiple product images instead. I am having trouble identifying the issue and need some assistance.

Has anyone experienced a similar problem? Any ideas on what could be causing this issue and how to resolve it? I appreciate any insights or suggestions. Thank you!

 

Here is the sample query:

 

products {
          edges {
          node {
              id
              legacyResourceId
              description
              title
              productType
              images(first: 1) {
              edges {
                  node {
                  id
                  url(transform: { maxWidth: 300, maxHeight: 300 })
                  originalSrc
                  }
              }
              }
          }
          }
      }

 

Reply 1 (1)

ShopifyDevSup
Shopify Staff
1453 238 501

Hi @nahid 👋

 

Paginating query parameters are optional in bulk operations, so the image connection will retrieve all images associated with the product. One option would be to use the `product.featureImage` or `product.featureMedia` if you'd like a single image per product. 

 

Hope that helps!

@Umiko

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog