Product count using Graphql.

parth-gondaliya
Shopify Partner
20 0 8

How to get product count in the shop using Graphql?

We can get it from REST but I couldn't found in GraphQl.

 

PLEASE HELP!!!

Replies 3 (3)

Gregarican
Shopify Partner
1033 86 285

I don't believe GraphQL can give you a one-shot count of all products in a Shopify store. The REST API call works, is pretty basic to implement, so I'd suggest just using that in your project. Figure there are no query parameters to utilize, no request body to construct, etc. Just invoke the proper URL, provide your API credentials, and the response will come back!

JoshHighland
Shopify Expert
193 10 70

With the recent depreciation of the REST api for products, we don’t have a solution for getting a product count now. 

SEO Manager - The FREE all-in-One SEO solution for Shopify
A powerful suite of SEO tools that gets you found in Google results

- Install SEO Manager -
ShopifyDevSup
Shopify Staff
1322 218 457

Hi @parth-gondaliya and @JoshHighland,

 

With the deprecation of the REST Product API, there is also a new GraphQL Admin API query that was released in version 2024-04 that does let you retrieve a count of all your products, though it is limited to returning a maximum of 10,000. The productsCount query doe also have a query filter that you can use to work around the 10,000 count limitation by making multiple queries, for example you can query for all products created before and after a certain date in separate calls to get the full count of your products.

Additionally there is also a variantsCount field on the Product object, to retrieve the amount of variants each product has as well.

 

I hope this helps, and I hope you have a great day 🙂

Developer Support @ Shopify
- Was this reply helpful? Click Like to let us know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog