Getting all product types in a collection?

Shopify Partner
13 0 10

Since the concept of a 'sub-type' does not exist within Shopify, it seems like the only way to effectively have a Category > Sub Category structure is to use Collections as the former and Type as the latter.


Now, however, I am faced with an issue here: In trying to create a headless storefront, using the Storefront API, it seems as if there is no way to simply get all product types within a collection?

It looks as if, the only way to do this, would be to get all products within every collection - store all these product types (for every product) in an array for every collection - and then dedupe these lists.

... But .. I can't ask for more than 250 products with this API?

Am I missing something here, or can't I really create a headless storefront with three dimensions of filtering (Category / Sub Category / Tag) using this API?

EDIT: I guess a way to achieve what I am trying to do, would be to keep track of, and store every product type that is present in a collection, in a metafield on this collection - but this seems hard to maintain.

Reply 1 (1)

Shopify Partner
13 0 10

Another idea to achieve something that seems like more than two dimensions of filtering with the Storefront API could be that everything just needs to be .. Tags (?)... and then it's up to me create these nested filtering concepts in my application myself?

An example would then be Product A:

In an ideal world, Product A would be in a Collection called "Toys", have a Type called "Squirt Gun" and a Tag called "Plastic".

As I mentioned above, filtering this properly with the Storefront API becomes difficult for various reasons. A big one being, that there is no notion of collection hierarchy built in to the Storefront API products query, and conversely, products cannot be filtered properly on Tag/Type dimensions with the collections query either.

If I then ditch Collections and Types all together - and instead adopt a Tag naming-scheme for Product A like so:


type_Squirt Gun

Shouldn't I theoretically be able to achieve multiple layers of hierarchical filtration with the Storefront API, if I create these concepts of hierarchy in my own application (Using Tags only)?

I'd love to hear some cons to this idea.