How can i get the total number of collections in my shopify store, Using API?

Highlighted
New Member
1 0 0

HI All,

 

I get the result for total number of products by using API => GET /admin/api/2020-01/products/count.json

then the question is what is the API for getting the total number of collections in my store?

0 Likes
Highlighted
Shopify Staff
Shopify Staff
1041 140 165

Hey @Ranjithkumar,

 

I'm not sure there's a REST API for this. Here's a GraphQL approach: https://shopify.dev/docs/admin-api/graphql/reference/queryroot#collections-2020-04

 

{
  collections(first:50) {
    edges {
      node {
        id
        title
      }
    }
  }
}
1 Like
Highlighted

@Ranjithkumar wrote:

HI All,

 

I get the result for total number of products by using API => GET /admin/api/2020-01/products/count.json

then the question is what is the API for getting the total number of collections in my store?


Hi @Ranjithkumar,

 

Maybe you can sum up custom collection count and smart collection count?

GET /admin/api/2020-04/custom_collections/count.json
GET /admin/api/2020-04/smart_collections/count.json
Co-Founder / Developer at https://merchbees.com
Our Shopify App: https://apps.shopify.com/merchbees-low-stock-alert
Merchbees Low Stock Alert - Keep track of your low stock items by email and slack
0 Likes