I\'m trying to filter WooCommerce product archive by custom attributes.
For example, there are 5 products with attribute \"color\" containing \"red\", and another 3
A plugin is probably your best option. Look in the wordpress plugins directory or google to see if you can find one. I found the one below and that seemed to work perfect.
https://wordpress.org/plugins/woocommerce-products-filter/
This one seems to do exactly what you are after