Previously, we can use productCreate with media
as a parameter. How do we attach media when using productSet? productSet
has a parameter for mediaId
, but how do we get the mediaId
? productCreateMedia requires productId
to create media, which creates a cyclical loop.
Hey @ronald_g
Below is a recommended approach. Let me know if this presents any challenges.
- Use fileCreate mutation to create files/media and get mediaIDs
- Use productSet to create the product and variants and associate them with the mediaIDs created in 1)
Thank you @Ashish_Shah . I have a few follow up questions:
-
The File.id returned by
fileCreate
is the same as the mediaId? -
Is fileCreate synchronous? Do we get the id immediately or need to wait like
productSet
to get the product.id? -
Even if using
productSet
, it seems to that we still need to useproductVariantsBulkCreate
to set inventory, is that correct? -
Since
productVariantsBulkCreate
already hasmedia
as an input argument, would that replace the need forfileCreate
?
Thanks
Just to add @Ashish_Shah ,
We started testing with fileCreate, however, is there documentation on how duplicateResolutionMode = REPLACE is supposed to work? In our tests new files keep getting created.
- The File.id returned by
fileCreate
is the same as the mediaId?
Yes
- Is fileCreate synchronous? Do we get the id immediately or need to wait like
productSet
to get the product.id?
The file processing is asynchronous, you can use the status of the file to know when it is ready
We started testing with fileCreate, however, is there documentation on how duplicateResolutionMode = REPLACE is supposed to work? In our tests new files keep getting created.
Are you using the same filename? The duplicateResolutionMode mode is taken into consideration if you are trying to specify the same filename. Without REPLACE a UUID is appended to the filename to deduplicate, with REPLACE it is treated effectively as an update.
Hey @ronald_g Hope you are doing great!
I just want to ask you how do you manage this scenario ? Actually i wanted to add shopify products using productSet bulk mutation with product media, variants and options. How do you manage this ?
can you please help me about it?
Thanks for your favour in advance
HI folks,
Wanted to let you know we have added ability to create files when calling productSet
https://shopify.dev/docs/api/admin-graphql/2024-10/input-objects/ProductSetInput#field-files
@AsafGitai Thanks for this update. Iām glad to see that. one more concern i have about the productSet API is how we can update quantity of the product using productSet during creation of the product in bulk mutation.?
Because if we use productSet for creation of the product it would not update the quantity.
We need one API for the product creation which include everything Like product variants, options, Images, quantity and inventory, cost, tags, collections, sales channel, category, product type, vendor and meta tags. It will be useful in sync up 2 or more store with master store. we transfer product from one store to another only by using just one query.
can you guide me about it ?
Thanks
Hi @syedusama0786 ,
You should now be able to update inventory quantities with ProductSet if you update to using the 2024-10 release candidate:
https://shopify.dev/docs/api/admin-graphql/2024-10/input-objects/ProductSetInventoryInput