Duplicate Product and Update variant info with GraphQL

Duplicate Product and Update variant info with GraphQL

LePong
Excursionist
25 1 19
Hi!
I need to be able to duplicate a product but update the price of the one and only variant that the product has.

Currently I have to make the duplicate product mutation, wait for the response, then make a second mutation to update the product variant using the ID that is returned in the response of the first mutation.

Is this the only way to do this, or is there a way to be able to batch the calls?

Thanks!
Reply 1 (1)

Josh
Shopify Staff
1134 84 234

Hey there, 

 

It sounds to me like you're doing this properly, I'm not aware of any way that you'd be able to perform both actions at the same time. You would need the product duplication to complete first so you could get the duplicate's ID to use with an update. 

 

 

Josh | 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 the Shopify Help Center or the Shopify Blog