Up to this point, we have been using the Collect API to easily fetch all the collections that a product belongs to.
GET /admin/api/2020-07/collects.json?product_id=632910392
Unfortunately, there is a breaking change in recent API versions, and this call won't return collects from smart collections anymore.
That puts us in a tricky situation!
How can we retrieve all of the SMART collections that a product belongs to?
Solved! Go to the solution
Hey @ClementBR,
This change was implemented starting with 2020-01, more details in our API blog here. The reason for the change is that we're planning to move away from collects altogether, which will allow products in collections to be queried with the new endpoint /collection/{{ collection_id }}/products.json
. 2020-01 introduced this change for smart collections, and you can expect to see further changes to the collection resource in the future. Keep an eye on the changelog for those announcements.
JB | Developer Support @ 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
Ah sorry, read your question backwards at first.
Totally understand the concern, so I've raised the question with our product team for clarification. I'll post back here with new info once I have it.
JB | Developer Support @ 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
This is an accepted solution.
Hey @ClementBR,
Just got clarification that this functionality actually is implemented, you can get all smart_collections a product belongs to using the smart collections endpoint with a query string for product_id:
GET /admin/api/{{ api_version}}/smart_collections.json?product_id=1234567890
Thanks for bringing this up, we'll look in to why this isn't in the documentation.
JB | Developer Support @ 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
D'oh! Not sure how I missed that, but thanks for pointing it out.
JB | Developer Support @ 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
User | Count |
---|---|
16 | |
12 | |
7 | |
6 | |
5 |