[FEATURE REQUEST] Filter products by variant count

Hello, is it possible to query products by variantCount? This is in regards to the 2048 variant count increase.

With my current setup, it’d be super efficent to be able to query products by variant count. Get one set of products with over 250 variants (using the variantCount query, for proper cursor pagination), and the other set with less than 250 variants. Use products to get products with less than 250 variants in bulk. Then product for getting products with over 250 variants.

As you can see here, this is not possible.

I know, I was hoping to request it to be added in the upcoming api release?

Aha, got it. Then you should update the title of this post or add new post.

For example,

[FEATURE REQUEST] Filter products by variant count

1 Like

Hey @Taj_Bowness , I’ll pass that on to the product team for you! I can see that would be useful.

As a workaround, one way you could do this is initially, query the products and include the variantCount in your query to identify these products:

{
    products(first:10) {
        nodes {
            variantsCount {
                count
                precision
            }
        }
    }
}

From there, add metafields (or tags) to the products to identify them as more or less than 250.

Once you’ve done the initial work to identify them, you could use product update webhooks, or even FLOW to update the metafields anytime a new variant is added.

You can then filter your queries based on tags or metafields going forward.

1 Like