Show/Hide WooCommerce Product Filters by Category

Hi all,

I’m hoping someone can point me in the right direction here; I’m trying to set up some product filters that, using ‘Conditions’ only display if the relevant Category has been selected, for example;

Customer selects Cables category, Cable Products display, I would like the customer to filter the attributes for the Cables (length, Type etc). But if the Customer selects Solar Products, Cable Filter does not display.

I’ve created my filters and added conditions, however ;

This doesn’t work
2023-05-16 12.09.43 staging.shop.ukevinstallers.co.uk 1fe67186ce1c

But this does;
2023-05-16 12.18.34 staging.shop.ukevinstallers.co.uk 0ad7cf0cb597

Can anybody explain to me why the {post_terms_product_cat} or {post_terms_product_tag} don’t fetch the data to evaluate. I’ve tried ‘contains’ and ==, I’ve also changed the slug as well as the category name (no hyphens etc) and as many other combinations.

How come it’s not as straightforward as selecting {post_terms_product_cat}, entering the category name and it just works!

Explanations gratefully appreciated, thanks.

Hi

I am using CONTAINS as the Operator for the post term category.

It works.

But you have to make sure that you write the value to be compared with exactly the same way the category is written, e.g. with capital letter if the category term is also written with a capital letter.

Cheers

Patric

2 Likes