答案如下:
function active_woocommerce_filters() {
// for older WC versions
// global $_chosen_attributes;
$_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes();
return count( $_chosen_attributes );
}
https://stackoverflow.com/questions/33229238/woocommerce-check-if-filtering-products