I find a code to remove all filters at once. It works like a charm.
But it add extra line even there is no selected filters. https://prnt.sc/20e69c7
I want to remove this line if there is no active filter.
/*Clean active filters, Use this as a shortcode [cleanthemall]*/
add_shortcode( 'cleanthemall', 'cleanthemall' );
function cleanthemall() {
$filterreset = $_SERVER['REQUEST_URI'];
if ( strpos($filterreset,'?filter_') !== false | strpos($filterreset,'?min_price') !== false | strpos($filterreset,'?max_price')) {
$filterreset = strtok($filterreset, '?');
echo '<div class="clear-filters-container"><a id="woo-clear-filters" href="'.$filterreset.'">Clean All Filters</a></div>';
}
}