Graphql API for products and variants count

Graphql API for products and variants count

adnan-mallik
Shopify Partner
6 1 4

As Shopify plans to deprecate the REST APIs in January 2025, I have been utilizing the REST API to retrieve the count of products and variants within the store. Given this upcoming change, I am seeking an alternative solution using Shopify's GraphQL API to obtain the same product and variant counts.

Although the GraphQL API provides a way to count products via the productsCount query, it currently only returns counts for up to 10,000 products. This limitation is problematic if the store has more than 10,000 products.


The current GraphQL query to count products looks like this:

 

graphql:  "{ productsCount(query: "id:>=limit") { count } }"

The REST API endpoint /admin/api/2020-10/products/count .json provides a count of all products in the store, but I need a GraphQL solution that can give me the complete count of products and variants, including those beyond the 10,000-product limit.

Could you please advise if there is a GraphQL API or alternative approach that can provide the total product and variant counts without this limitation?


Thank you in advance for your assistance.

Replies 0 (0)