woocommerce_shortcode_products_query

The WooCommerce woocommerce shortcode products query hook.

Description

apply_filters( 'woocommerce_shortcode_products_query', (unknown) $query_args, (unknown) $atts, (string) $loop_name ); 

Parameters (3)

0. $query_args (unknown)
The query args.
1. $atts (unknown)
The atts.
2. $loop_name (string)
The loop name.

Usage

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

Defined (2)

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

/includes/class-wc-shortcodes.php  
  1. $query_args = apply_filters( 'woocommerce_shortcode_products_query', $query_args, $atts, $loop_name ); 
  1. $products = new WP_Query( apply_filters( 'woocommerce_shortcode_products_query', $args, $atts ) );