How to create dependent filters

I have a very large collections which contains elements with many attributes: i.e. manufacturer, material, application, etc.

I can setup filters to allow users to sort the list but they can not be “connected”. If users choose all filters, they often end up with an empty list because no item is matching all filters.

I would like to create filters so that they are dependent on each other, i.e. if someone chooses a certain filter (i.e. a certain manufacturer), that in the other filters (i.e. material) only options show up which have an entry with the specific manufacturer choosen before.

You have this behaviour in most filters of online stores where you can choose color and size and once you have choosen a color only sizes show up which are available for the chosen color

Is it possible to create such dependent filters?

Product:
Wix studio

1 Like

You can accomplish this through using Wix Data Queries with Data Filters.

By binding the onChange() event of each element the user selects to filter the collection, you can build custom queries that connect all of the user specified filters to get and display the results via a repeater.

Here is a example of this being accomplished on a hypothetical real estate listing site:

Note: This method will query your database for every filter, you can reduce the amount of backend requests by filtering the .data property on the repeater assuming you have all of the data required to list any result already in this array of objects.

Thank you very much! Unfortunatly, the site seems down you referred to.