Getting total variant count

Is there anyway to get a total count of variants in a store?

I need to display the current amount to a customer in my app to help them decide on which plan to choose. Once I’ve synced all their data into my database I’m able to calculate this, but until that happens I won’t have the total count.

I’m aware of productVariantsCount - GraphQL Admin but does this impose the same 10,000 limit at productCount?

EDIT: If it does impose the 10,000. Shopify what the hell is going on? How can you provide this endpoint which won’t return true data. This needs to be sorted asap. I’ve seen the same frustrations from others with the productCount endpoint.

Hi Luke,

I’ve confirmed with the product team in this area that there is currently no limit on the productVariantsCount query, so you should be able to retrieve over 10K variants with this.

Okay great thanks Liam. why is the variant one not limited but the products one is?

I also posted another issues related to this where its returning the wrong count → productVariantsCount returning wrong value

Hi @Liam-Shopify,

This:

{
  productsCount {
    count
    precision
  }
  productVariantsCount {
    count
    precision
  }
}

returns this:

{
"productsCount":{"count":10000,"precision":"AT_LEAST"},
"productVariantsCount":{"count":858207,"precision":"EXACT"}
}

Are there any plans to remove the limit on that like the productVariantsCount?

1 Like