Categories on attribute archive pages

Question

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?

0
John Doe 2 months 0 Answers 14 views 0

Leave an answer