woocommerce_is_filtered

Is_filtered - Returns true when filtering products using layered nav or price sliders.

Description

Parameters (1)

0. $sizeof_wc_query_get_layered_nav_chosen_attributes_0_isset_get_max_price_isset_get_min_price_isset_get_rating_filter (unknown) => ( sizeof( WC_Query::get_layered_nav_chosen_attributes() ) > 0 || isset( $_GET['max_price'] ) || isset( $_GET['min_price'] ) || isset( $_GET['rating_filter'] ) )
The sizeof wc query get layered nav chosen attributes 0 isset get max price isset get min price isset get rating filter.

Usage

To run the hook, copy the example below.
  1. $sizeof_wc_query_get_layered_nav_chosen_attributes_0_isset_get_max_price_isset_get_min_price_isset_get_rating_filter = apply_filters( 'woocommerce_is_filtered', $sizeof_wc_query_get_layered_nav_chosen_attributes_0_isset_get_max_price_isset_get_min_price_isset_get_rating_filter ); 
  2.  
  3. if ( !empty( $sizeof_wc_query_get_layered_nav_chosen_attributes_0_isset_get_max_price_isset_get_min_price_isset_get_rating_filter ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the woocommerce_is_filtered callback 
  2. function filter_woocommerce_is_filtered( $sizeof_wc_query_get_layered_nav_chosen_attributes_0_isset_get_max_price_isset_get_min_price_isset_get_rating_filter ) { 
  3. // make filter magic happen here... 
  4. return $sizeof_wc_query_get_layered_nav_chosen_attributes_0_isset_get_max_price_isset_get_min_price_isset_get_rating_filter
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'woocommerce_is_filtered', 'filter_woocommerce_is_filtered', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'woocommerce_is_filtered', 'filter_woocommerce_is_filtered', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/includes/wc-conditional-functions.php  
  1. return apply_filters( 'woocommerce_is_filtered', ( sizeof( WC_Query::get_layered_nav_chosen_attributes() ) > 0 || isset( $_GET['max_price'] ) || isset( $_GET['min_price'] ) || isset( $_GET['rating_filter'] ) ) );