productCounts query limitation

Documentation says that this query limited to 10000 products:

Not sure what’s suggested to do for larger stores. Loading all products just to get the count seems inefficient. And the REST API didn’t had this limitation, I just tried getting products count on store with 1.5M products and it worked fine.

6 Likes

I can’t help with this one, but we certainly had a lively and long thread all about this some time ago. The fun never stops does it! My favorite aspect is the resolution you just pointed out that was thrust upon us as the result a few months ago.

  • with precision, we can use GQL to get a count if the count is less than 10,000
  • any product with more than 10,000 we simply get an acknowledgement that this product has at least 10,000 and an unknown number more. Money in the bank baby!

And we cannot know this unknown number, because ???

It reminds me of the same problem Shopify has had for nearly 20 years now. No matter your store, whether you have 51 or 501 or 5000001 products in it, Shopify never shows you that number.

I think the only option, using GraphQL, is to query products and use pageInfos hasNextPage and endCursor to paginate the responses and accumulate the total amount.

Also, if a manual check up can do, you can use https://admin.shopify.com/store/{{shop_name}}/products/count.json, but you probably already know that.

1 Like

Limit counting up to 10k items. Shopify, are you joking? It shameful to even have this kind of a limit. Now we need to run a binary partitioning of data on timestamp to get a real count? Making 10, 20, 30, 100 queries?

For now it’s best to use REST as it seems to work. GraphQL is not finished, please don’t remove REST!

2 Likes

And exactly the same issue happens with GraphQL orders count (‘ordersCount’ query). It has also a limit of 10000.

We’re looking at options to increase the limit beyond 10K. One of the challenges is data cuts across multiple DBs + filter support.

Question: Do your use cases require exact counts with filters? Eliminating filters should make it easier to support much larger counts with EXACT precision (we would still support filters, just with less accuracy)

Hi Darius_Gai,

in our case, we use a simple filter with REST API: “published_status=published”.

Anyway, comparing with current GraphQL options, filters with non exact precision or even no filters would be a great advance.

Thanks.

2 Likes

Adding in here, its ridiculous that we have this 10,000 limit.

I’ve posted about productVariantCount too, not sure if this imposes the same limit.

FYI, Liam has just confirmed there isn’t a limit for productVariantsCount, so I see no reason to have productsCount updated to have no limit.

Hi Darius,

We are facing a similar issue where it’s crucial for us to obtain the exact total product count without any filters. Our app’s subscription plans are directly based on this value, so moving from REST API to the new approach is challenging if we can’t accurately determine this count. Currently, we’re using the REST API for this purpose, and this change impacts our core functionality.

How is obtaining exact overall counts supposed to work in the new API? Specifically, for products, and ideally also for metafields of a given entity?

Any updates on this? Pretty strange that productVariantsCount is not limited while productsCount is.

1 Like