How to use multiple data-attributes to filter products in the catalog?

Good day!
Please tell me how to use many data-attributes to filter products in catalog if there is already one data-attribute (data-category) and there is a JS code for it, and how to add for example, another filter?
It is necessary for each attribute to write this JS code, replacing all the attributes or how can one describe it all?

Here is the screenshot (there is one filter, I want to add, for example, weight)
5df09a7741b5f794365963.jpeg

Example with one filter:
https://codepen.io/igor307/pen/abzNOQR
April 3rd 20 at 17:25
1 answer
April 3rd 20 at 17:27
Solution
Logic: each new filter is filtering data to a previous state. Not the original. So, it's kind of doll. Added the 1st filter, the second will be exactly the same to work, but to filter the result of the 1st filter. The logic is clear, then design an algorithm and write code

Find more questions by tags CSSJavaScriptHTML