Liquid, JavaScript, themes, sales channels
I know it's possible to retrieve custom-collections from its endpoint. I'm wandering if it's possible to see the collections a product belongs to when making a Get request to the products endpoint? This way I don't have to make another external API call.
Apologies if this is obvious but I've looked on the Product JSON response object and can't find it.
Thanks.
Hi,
You are looking for the collect endpoint. https://shopify.dev/docs/admin-api/rest/reference/products/collect
GET /admin/api/2021-01/collects.json?product_id=XXXXXXXXX
Apologies I don't think I was clear. I want to be able to make a get request for all products:
/admin/api/2021-01/products.json
... and within the response to see, for each product, which collections they belong to.
Hi,
With the rest api, you first need to get all the products and then loop through the products and get the collects for each of them. What you want does not exist in rest api.
Maybe you should have a look at the graphql product endpoints.
Are you ready to take your business to the next level? Look no further than the latest ...
By SarahF_Shopify Apr 15, 2024We’re keeping the ball rolling to make sure you’re always ahead of the game. So buckle ...
By JasonH Apr 8, 2024Portrait of Stephen positioned next to an image of planet Earth, with the Stephen's World ...
By JasonH Mar 18, 2024