Out now! Check out the Poll results: Do you have a Shopify store?
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.

Update a product via GraphQL using product handle in a single API call

Update a product via GraphQL using product handle in a single API call

klerasoft
Shopify Partner
1 0 0

Hi everyone,

 

Why is it that when creating a new product via productSet mutation, it is enough to use only a product title/handle (which is unique anyway and known in advance on the ERP side), but when updating an already existing product, I need to first query the id of the same product using productByHandle query and then use this id to update the product with the same productSet mutation? It seems I need to make two API calls to update a product and only one call to create a product. This makes it very difficult to connect a database directly to Shopify via middleware platforms without UPSERT function support. Is there anyway other than writing a script to achieve this in a single GraphQL query/mutation?

 

Thanks.

Replies 0 (0)