Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

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 524

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