The last step to making our category page just like any other shop is the introduction of filtering. Filtering allows you to find products that have particular sizes, colors, tags, or manufacturers. Our filtering options are going to be built from the products on the page. For example, if none of the products have an XL size or a blue color, there is no point showing that as a filter.
To achieve this, we are going to need to pass the products of the current category to the filtering component as well. However, the products get processed on the CategoryPage component. Instead of repeating this processing, we can move the functionality to a Vuex store getter. Getters allow you to retrieve data from the store and manipulate it like you would in a function on a component. Because it is a central place, however, it means several components can benefit from the...