From productSet:
Any list field will be updated so that all included entries are either created or updated, and all existing entries not included will be deleted.
I want to do the same with the relationship in the collection->products
entity. Currently, if I need to sync a change like “added 2 more products to a collection, and removed 3 products from it”, I have to do the following:
- use
collection
to get all associated products (this is not cool since theproducts
is a relationship, and we have to paginate them instead of getting the entire array of ids in one shot ) - make a diff in our app
- send a
collectionRemoveProducts
request to delete the products that we want - send a
collectionAddProductsV2
request to add new products
This seems like a lot of work to do: pagination, pooling for both remove and add jobs, where as productSet
makes everything so easy.
My app is the source of truth, and shopify should give me the tools to do updates in a straightforward manner.