woocommerce_analytics_(field) хук-фильтрWC 1.0

Filter the IDs before retrieving report data.

Allows filtering of the objects included or excluded from reports.

Использование

add_filter( 'woocommerce_analytics_(field)', 'wp_kama_woocommerce_analytics_field_filter', 10, 4 );

/**
 * Function for `woocommerce_analytics_(field)` filter-hook.
 * 
 * @param array  $ids        List of object Ids.
 * @param array  $query_args The original arguments for the request.
 * @param string $field      The object type.
 * @param string $context    The data store context.
 *
 * @return array
 */
function wp_kama_woocommerce_analytics_field_filter( $ids, $query_args, $field, $context ){

	// filter...
	return $ids;
}
$ids(массив)
List of object Ids.
$query_args(массив)
The original arguments for the request.
$field(строка)
The object type.
$context(строка)
The data store context.

Где вызывается хук

DataStore::get_filtered_ids()
woocommerce_analytics_(field)
DataStore::get_filtered_ip_addresses()
woocommerce_analytics_(field)
woocommerce/src/Admin/API/Reports/DataStore.php 1456
$ids = apply_filters( 'woocommerce_analytics_' . $field, $ids, $query_args, $field, $this->context );
woocommerce/src/Admin/API/Reports/Downloads/DataStore.php 225
$ip_addresses = apply_filters( 'woocommerce_analytics_' . $field, $ip_addresses, $query_args, $field, $this->context );

Где используется хук в WooCommerce

woocommerce/src/Admin/API/Reports/Coupons/DataStore.php 74
add_action( 'woocommerce_analytics_delete_order_stats', array( __CLASS__, 'sync_on_order_delete' ), 5 );
woocommerce/src/Admin/API/Reports/Customers/DataStore.php 100
add_action( 'woocommerce_analytics_delete_order_stats', array( __CLASS__, 'sync_on_order_delete' ), 15, 2 );
woocommerce/src/Admin/API/Reports/Products/DataStore.php 103
add_action( 'woocommerce_analytics_delete_order_stats', array( __CLASS__, 'sync_on_order_delete' ), 10 );
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/DataStore.php 83
add_action( 'woocommerce_analytics_delete_order_stats', array( __CLASS__, 'sync_on_order_delete' ), 15 );
woocommerce/src/Admin/API/Reports/Taxes/Stats/Controller.php 35
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' ) );
woocommerce/src/Blocks/Domain/Services/DraftOrders.php 42
add_filter( 'woocommerce_analytics_excluded_order_statuses', [ $this, 'append_draft_order_post_status' ] );