woocommerce_analytics_(snake_name)_select_query filter-hookWC 9.3.0

Filter report query results.

Usage

add_filter( 'woocommerce_analytics_(snake_name)_select_query', 'wp_kama_woocommerce_analytics_snake_name_select_query_filter', 10, 2 );

/**
 * Function for `woocommerce_analytics_(snake_name)_select_query` filter-hook.
 * 
 * @param stdClass|WP_Error $results Results from the data store.
 * @param array             $args    Query args used to get the data (potentially filtered).
 *
 * @return stdClass|WP_Error
 */
function wp_kama_woocommerce_analytics_snake_name_select_query_filter( $results, $args ){

	// filter...
	return $results;
}
$results(stdClass|WP_Error)
Results from the data store.
$args(array)
Query args used to get the data (potentially filtered).

Changelog

Since 9.3.0 Introduced.

Where the hook is called

GenericQuery::get_data()
woocommerce_analytics_(snake_name)_select_query
woocommerce/src/Admin/API/Reports/GenericQuery.php 89
return apply_filters( "woocommerce_analytics_{$snake_name}_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' ) );