Categories on attribute archive pages


I have WordPress + Woocommerce site setup with about ~2k products. Products have several different attributes like "Brand" and attribute values for "Brand" like "Samsung", "Philips" etc.

On "Brand" archive page like "Samsung Archives" I want to show menu of product categories containing products with that attribute. ("Samsung products") Others I don’t want to show.

I guess one way would be to query all products in category loop, then query for attributes and depending on result show/hide this category on menu. The problem is that this method can impact performance if archive page is visited a lot and/or category tree is big.

Probably someone knows better approach for this and wants to share with it?

John Doe 9 months 2020-11-21T17:10:28-05:00 0 Answers 14 views 0

Leave an answer