Reputation: 5
I want all the collections of specific products in Shopify. But I didn't get any proper information in Shopify documents as well. I have also reviewed below Stackoverflow link. But it is not working.
Can anyone help me that is it possible? If yes then how?
Reviewed Stackoverflow Link: https://stackoverflow.com/questions/14230720/getting-collection-names-of-products-in-shopify
Thanks.
Upvotes: 0
Views: 2881
Reputation: 48
You will need to use either the CustomCollection API. Which is
A collection is a grouping of products that merchants can create to make their stores easier to browse. For example, a merchant might create a collection for a specific type of product that they sell, such as Footwear. Merchants can create collections by selecting products individually or by defining rules that automatically determine whether products are included.
From here you can use this to retrieve all custom collections that contain a particular product
GET /admin/api/2019-10/custom_collections.json?product_id=632910392
If it is a SmartCollection
A smart collection is a grouping of products defined by rules that are set by the merchant. Shopify automatically changes the contents of a smart collection based on the rules. Smart collections, like other types of collections, are used to break down the catalog of products into categories and make the shop easier to browse.
You can use this to get a list of all Smart Collections for a specific product ID
GET /admin/api/2019-10/smart_collections.json?product_id=632910392
Upvotes: 0