Discuss all the new features introduced with the new product model in GraphQL.
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.
Solved! Go to the solution
This is an accepted solution.
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
Hey @ronald_g
Below is a recommended approach. Let me know if this presents any challenges.
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
Thank you @Ashish_Shah. I have a few follow up questions:
1. The File.id returned by `fileCreate` is the same as the mediaId?
2. Is fileCreate synchronous? Do we get the id immediately or need to wait like `productSet` to get the product.id?
3. Even if using `productSet`, it seems to that we still need to use `productVariantsBulkCreate` to set inventory, is that correct?
4. Since `productVariantsBulkCreate` already has `media` as an input argument, would that replace the need for `fileCreate`?
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.
> 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.
To learn more visit the Shopify Help Center or the Community Blog.
> 1. The File.id returned by `fileCreate` is the same as the mediaId?
Yes
> 2. 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
To learn more visit the Shopify Help Center or the Community Blog.
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
This is an accepted solution.
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