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

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
Shopify Staff
Shopify Staff
1041 140 176

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
      }
    }
  }
}
Notice; Out of office, replies will be delayed until my return. Thanks!

@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: merchbees
Merchbees Low Stock Alert - Keep track of your low stock items by email and slack
Merchbees Inventory Value - Know your inventory value and quantity in real-time
Push Down & Hide Out of Stock - Move out of stock products to the bottom of the collection to improve SEO & hide/ unhide automatically
0 Likes
New Member
1 0 0

Easiest way to get the total products in your store OR total collections in your store

 

https://YOUR-STORE-NAME.myshopify.com/admin/products/count.json into your browser and hit enter.

OR

https://YOUR-STORE-NAME.myshopify.com/admin/collections/count.json into your browser and hit enter.

 

(replace YOUR-STORE-NAME with your store name, including dashes).

 

Hope this helps!

 

 

0 Likes