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 updating variants from different products

Bulk updating variants from different products

newbie_01
Shopify Partner
34 0 13

Very excited about the upcoming changes.

One of my most common tasks is to update variant stock at locations, prices (including secondary markets) and metafields.

The mutation `productVariantsBulkUpdate` can only take one product at a time so it needs to be called thousands of times. It seems this doesn't change even in the unstable api version.

Will the new `productSet` mutation help with this?

Is there a sneak preview of what that mutation is shaping up to be?

 

Thanks

Replies 2 (2)

Ashish_Shah
Shopify Staff
22 7 11

Hello

Thanks for your question.

You will need to call the productVariantsBulkUpdate for every product whose variant information you need to change (Eg.  inventory , prices, metafields)

This may not apply to your workflow, but another option for you is to use the Product CSV Import functionality on Admin

ALIAS | Shopify 
 - Was my reply helpful? Click Like to let me 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

kestutisbalt
Shopify Partner
11 0 10

I agree with that. Bulk updating variants for multiple products would be the expected behavior of this endpoint. It's very limiting to only allow bulk updates for a single product. At the very least, improve its data validation; when a non-existing variant ID is given, the rest of the variant update operations fail as well, even when partial updates are specified in the mutation. It should return an error for non-existing variants and apply changes only to variants that exist.