No api to get a total count of variants?

Excursionist
40 0 5

I need to get a total count of all variants. 

 

The endpoint to do this with products is:

/admin/products/count.json

However there doesn't seem to be a way to get a total variants count, only the amount of variants per product which isn't useful. 

 

/admin/products/#{product_id}/variants/count.json

I would have to loop through each product making 100's of calls to count the number of total variants, or use

 

/admin/products.json

and then count the variants in the array. Is there a simpler way?

3 Likes
Highlighted
Shopify Partner
4 0 4

Also, got the problem here.

This is particularly confusing since many other entities (customers, orders, products) have this very handy "count" endpoint.

 

Besides, it seems that the GraphQL API also lacks the ability to get the total count of records.

https://community.shopify.com/c/Shopify-APIs-SDKs/Get-total-number-of-products-in-collection-with-St...

Product Owner - Joone (https://www.joone.fr)
1 Like
Highlighted
New Member
2 0 1

Did you ever figure out a way to do this? 

1 Like