Hello Fredi
I want to tell you that its possible, but look here please https://epood2.surgitech.ee/shop/swoof/product_cat-glukomeetrid/ – when you open this link you see subcategories of the current selected category, and all its products, so nothing here to activate because in the filter are shown only its subcategories which are waiting for customer click. Sure you will ask why that, and why not to show parent clicked subcategory – because its already selected and imagine if user decided to uncheck it – what content in this case the plugin should show them?
But I can suggest next – dynamic widget title:
To dynamically change the title of the widget containing the phrase “cat_label_to_redraw” (just paste this name instead of simple text) depending on what page the user is on. Here’s how you can implement it:
Goal: Change the widget title based on the current category page. If the widget contains the text “cat_label_to_redraw” and the user is on a category page, the title will change to the name of the current category. If the user is not on a category page, the title will be “Product Filter” (or empty, just change it in the code).
Solution: We will use hook widget_title filter, which allows us to modify the widget title before displaying it. Depending on the condition, we will change the title to the desired value.
add_filter('widget_title', function ($title, $instance, $id_base) {
if (strpos($title, 'cat_label_to_redraw') !== false) {
if (is_product_category()) {
$current_category = get_queried_object();
$title = esc_html($current_category->name);
} else {
$title = 'Product Filter';
}
}
return $title;
}
, 10, 3);
This approach allows you to flexibly adapt the widget title depending on the context, improving the user experience on your site. If you have any questions or need additional help, let me know!