Collection product count by API

Collection product count by API

tttdog
Visitor
2 0 1

Hello,

 

We currently stuck with counting published products in collection.

 

We tried use ADMIN API 

/admin/api/2020-01/collects/count.json?collection_id=12345678

But this way counting all product not published products.

 

Is there anyway to count with Storefront API or Admin API , Please help


Thank you 

Reply 1 (1)

mfowler
Shopify Partner
2 0 0

Yes, try to add some parameters. Like: &status=ACTIVE

 

So in your reference: 

 

/admin/api/2020-01/collects/count.json?collection_id=12345678&status=ACTIVE  

 This worked for me to not count products w/ draft status.