H
H
hekiro2018-09-28 01:24:09
WooCommerce
hekiro, 2018-09-28 01:24:09

How to disable the product filter at the category level?

Hello. How to disable the product filter at the level of the main category, and display only in subcategories? I am using the standard. filter Woocomerce, "Filter products by attributes". What code should be removed and where? Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
max3wq, 2021-04-01
@max3wq

Good afternoon, you can wrap the position of the filters or the sidebar in a validation condition

$category = get_queried_object();
if($category->parent != 0) {
//Мы в дочерних категориях
} else {
//Мы в корневой категории
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question