Seeking Clarity on Bulk Product Updates via GraphQL

24 2 7

Hello Shopify Community,

I'm reaching out to address a topic that seems to be a common point of confusion and discussion among us - bulk product updates using GraphQL. While Shopify's flexibility with GraphQL queries is a powerful feature, it also brings some ambiguity, especially regarding what is possible and what isn't. Shopify themselves have mentioned the challenge in providing exhaustive examples due to this flexibility.

The Core of the Issue

After extensive research and reading everything available about bulk product updates, it's clear that there's a need for more detailed documentation. This is particularly true concerning the structure and limitations of GraphQL queries in this context.

For instance, the existing documentation states certain restrictions for bulk operations, such as the maximum number of connections and the depth of nested connections. However, practical examples or case studies illustrating these restrictions are scarce.

The Big Questions

This brings us to a set of crucial questions that many of us are grappling with:

  1. Bulk Product Update Capabilities:
    • Can we update product variants in bulk together with updates to the product itself
    • like bodyHtml?
    • Is it possible to update media (images) in bulk together with updates to the product itself like bodyHtml?
    • Can both variants and media be updated simultaneously, along with other fields like bodyHtml?


  2. If not methodology:

    • Should we use productVariantsBulkUpdate for updating variants?
    • For media updates, is productUpdateMedia the right approach, especially in a bulk operation context
  3. Potential Workarounds:
    • Based on the current understanding, it seems we might need to perform three separate operations:
      a. Bulk product update for fields like bodyHtml, status, etc.
      b. Bulk variants update.
      c. Bulk media update.

A Collective Effort for Better Understanding

I believe many of us are in the same boat, trying to navigate these unclear waters. It's not just about finding a workaround; it's about understanding

the underlying mechanics and limitations of Shopify's GraphQL API for bulk operations.

Why This Matters

  • Clear documentation and examples would significantly ease the development process, allowing us to efficiently manage large inventories.
  • Understanding these limitations and capabilities is crucial for planning and implementing robust e-commerce solutions on the Shopify platform.

Request for Insights and Experiences

  • I'm calling on fellow community members who have tackled similar challenges: What insights can you share?
  • If anyone has successfully implemented bulk updates involving variants, media, or other complex scenarios, your input would be invaluable.
  • Shopify team, your expert clarification on these points would be greatly appreciated. It would help not just in resolving current confusions but also in setting a clearer path for future developments.


Let's use this thread as a resource hub for bulk product updates via GraphQL. By sharing our findings, experiences, and even unresolved queries, we can collectively enhance our understanding and utilization of Shopify's powerful features.

Looking forward to an engaging and informative discussion!

Best regards, Eliaz Fält

The pessimist sees only the tunnel; the optimist sees the light at the end of the tunnel; the realist sees the tunnel and the light - and the next tunnel.
Replies 2 (2)

Shopify Partner
11 1 0

Such a good analysis and recommendations. The post is two months old and I see no response from either the community or shopify dev team? Are these issues already resolved ?

24 2 7

How to Create and Update Media for Products and Variants Using Bulk Operations in Shopify

I have gotten some questions regarding how one can modify media content with bulk operations/mutations. Here’s a detailed guide on how to achieve this:


Step 1: Create Media and Associate it with a Product

To start, we need to create media (images) and associate them with a product. Use the following mutation to create media:


mutation productCreateMedia($productId: ID!, $media: [CreateMediaInput!]!) { productCreateMedia(productId: $productId, media: $media) { media { id alt } mediaUserErrors { field message } product { id } } }

When you run this mutation in Python, make sure to fetch the media ID from the response:


{ "data": { "productCreateMedia": { "media": [ { "id": "gid://shopify/MediaImage/123123123", "alt": "New Image Description" } ], "mediaUserErrors": [], "product": { "id": "gid://shopify/Product/321321321" } } } }

Store this media ID in your database along with the product information so that you know which media is associated with which product.


Step 2: Use Bulk Operations to Update Media

Once you have the media IDs stored, you can use bulk operations to update this media. Here’s the mutation for bulk updating media:


mutation { bulkOperationRunMutation( mutation: "mutation productUpdateMedia($media: [UpdateMediaInput!]!, $productId: ID!) { productUpdateMedia(media: $media, productId: $productId) { mediaUserErrors { field message } product { id } } }", stagedUploadPath: "STAGED_UPLOAD_PATH_PLACEHOLDER" ) { bulkOperation { id url status } userErrors { message field } } }


Example Input for Bulk Mutation (Multiple Rows):

{"media": {"alt": "test", "id": "gid://shopify/MediaImage/123123", "previewImageSource": ""}, "productId": "gid://shopify/Product/321321"} {"media": {"alt": "test", "id": "gid://shopify/MediaImage/465456", "previewImageSource": ""}, "productId": "gid://shopify/Product/654654"}


Step 3: Handling Variants

For product variants, you need to loop through and use the productVariantUpdate mutation at least once without bulk operations. This initial step ensures that you have the media IDs associated with each variant stored in your database. Once you have these associations, you can use bulk mutations to update the media for variants similarly to how it’s done for products.


Example Mutation for Updating a Variant:


mutation updateProductVariant($input: ProductVariantInput!) { productVariantUpdate(input: $input) { productVariant { id image { id src } } userErrors { field message } } }



Final Notes:

While these steps provide a viable solution, it's important to acknowledge the frustrations many developers face when working with Shopify's bulk operations. The lack of direct tools for adding and changing media in bulk operations can be cumbersome. This workaround, involving initial individual media creation and subsequent bulk updates, highlights the inefficiencies in the current system.

It would greatly benefit the community if Shopify introduced more comprehensive bulk operation capabilities, allowing for direct creation and modification of media content. The current limitations not only slow down workflows but also require additional storage and management of media IDs, which could be streamlined with better tools.

Despite these challenges, understanding and leveraging the available mutations and bulk operations can still lead to effective management of media content across products and variants.

The pessimist sees only the tunnel; the optimist sees the light at the end of the tunnel; the realist sees the tunnel and the light - and the next tunnel.