woocommerce_analytics_(context)_select_query filter-hookWC 9.3.0

Called after the data is fetched. The results can be modified here.

Usage

add_filter( 'woocommerce_analytics_(context)_select_query', 'wp_kama_woocommerce_analytics_context_select_query_filter', 10, 2 );

/**
 * Function for `woocommerce_analytics_(context)_select_query` filter-hook.
 * 
 * @param stdClass|WP_Error $results The results of the query.
 * @param                   $args    
 *
 * @return stdClass|WP_Error
 */
function wp_kama_woocommerce_analytics_context_select_query_filter( $results, $args ){

	// filter...
	return $results;
}
$results(stdClass|WP_Error)
The results of the query.
$args
-

Changelog

Since 9.3.0 Introduced.

Where the hook is called

In file: /src/Admin/API/Reports/FilteredGetDataTrait.php
woocommerce_analytics_(context)_select_query
woocommerce/src/Admin/API/Reports/FilteredGetDataTrait.php 56
return apply_filters( "woocommerce_analytics_{$this->context}_select_query", $results, $args );

Where the hook is used in WooCommerce

woocommerce/src/Admin/API/Reports/Products/Stats/Controller.php 47
add_filter( 'woocommerce_analytics_products_stats_select_query', array( $this, 'set_default_report_data' ) );
woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php 36
add_filter( 'woocommerce_analytics_taxes_stats_select_query', array( $this, 'set_default_report_data' ) );
woocommerce/src/Admin/API/Reports/Variations/Stats/Controller.php 45
add_filter( 'woocommerce_analytics_variations_stats_select_query', array( $this, 'set_default_report_data' ) );