New Shopify Certification now available: Liquid Storefronts for Theme Developers

Exclude empty collections from query

abater
Shopify Partner
8 0 2

Is it possible to exclude empty collections from my query when using the Storefront API? I'm trying to construct a menu and I don't want to present collections with no products.

Reply 1 (1)
c10s
Shopify Partner
67 12 23

I don't believe there is a way to do it with the API alone. Would filtering the query result on the client before constructing the menu work? (eg. if products.edges is an empty array you know it's an empty collection)