Discuss all the new features introduced with the new product model in GraphQL.
There is a RESTful API to get products count by query:
https://shopify.dev/docs/api/admin-rest/2024-01/resources/product#get-products-count
We are using the API the preview the product count selected by customer, it is very useful.
Please consider to add the API in GraphQL API.
Thanks
Thanks @ecoworkhome. Agreed, that would be handy. Passing along your feedback!
Scott | Developer Advocate @ Shopify
I have been writing Apps since the first API was released, and I still use this feature as part of my logic. I need to know how many products are in a store before I do certain sync operations. Making a quick call to count() was great. Now that the brainiacs have decided that is too expensive, what are we left with? Does Shopify seriously expect me to do a bulk export of an entire store to get started, and then babysit each and every delete and create myself to keep that number current?
Killing the REST api for products and not having a simple count is crazy. I depend on it and I'm guessing a ton of other apps do also!
I figured it out. There is a new GQL endpoint in 2024-04 that works as a substitute. It is accurate up to 10000 and after that you have to deal with the concept that there are more than 10000.
Hello Hunky Bill,
But how to manage for a store which contains more than 10,000 products then how can we get total products count via graphql API as now REST API > count.json is deprecated.
Can you please guide us ASAP?
Any progress on this?
For how long will the Count work for the rest api as I read you are deprecating the /product endpoint on rest api.
you can use this:
{
productsCount {
count
}
}
See here: https://shopify.dev/docs/api/admin-graphql/2024-04/queries/productsCount