Hi @AsafGitai
Shopify provides the productSet mutation as a solution for database sync workflows, such as syncing data from an ERP system. Logically, in this case, I would use the bulk operation.
In such a workflow, I can’t see how using the inventoryItemUpdate or productVariantsBulkUpdate mutations would be a viable solution for managing inventory or solving the inventory item tracking issue.
Let’s consider we have 5K products with 4-5 variants for each product. If I were to use productVariantsBulkUpdate, I would need 5K requests, and with inventoryItemUpdate, I would need 20-25K requests to track the inventory items.
For database sync workflows, I would use inventorySetQuantities, which allows me to update multiple variant quantities without grouping them at the product level.
This brings us to @adearriba question: why did you remove the inventoryItem object in the first place?
On the other hand, we can’t send media using productSet as we do with the productCreate mutation. To complicate matters, productCreateMedia is not available in bulk operations.
So, if I want to use productSet to create 100 new products with 4-5 variants each, I would need to send 100 requests to productVariantsBulkUpdate to track the inventory items, or 400-500 requests using inventoryItemUpdate. Then, I must send another 100 requests to create the media using productCreateMedia, and another 100 requests to publish the products using publishablePublish because the publications object is also removed from productSet.
This is a lot of work for a database sync workflow. In this workflow, I expected that productSet would sync the data in one shot.
As a workaround, I thought to use the following steps:
- Use bulk operations to create the products with media using the productCreate mutation.
- Then use bulk operations to create the product variants and track the inventory items using the productVariantCreate mutation. However, I was surprised to find that this mutation is not available in bulk operations.
So, I changed the plan to:
- Use bulk operations to create the products with media using the productCreate mutation and make sure to use the productOptions object to create dummy variants.
- Use bulk operations to update the dummy variants with the correct data and track the inventory items using productVariantUpdate.
- Use bulk operations to publish the products using publishablePublish.
But this is still a lot of work for a database sync workflow.
I hope that your team considers the following points:
- Modify the productSet mutation to accept the inventoryItem object and the publications object. It would be perfect if we could add the media too. If not, then at least add productCreateMedia to bulk operations so we can truly use productSet to sync the data in one shot.
- If this is not possible, can you at least add productVariantCreate to bulk operations?
Regards,