Wordpress how to override function get_order_report_data from wc_admin_report
This question seems a bit muddled, but here is my best interpretation.
If you want to add a custom status to capture in the query write a filter function like this:
function woocommerce_reports_order_statuses_filter( $order_status ){ $order_status[] = 'custom_status'; return $order_status;}add_filter( 'woocommerce_reports_order_statuses', 'woocommerce_reports_order_statuses_filter' );
Later on in the function all the statuses in that array get 'wc-' appended to their values for the actual query string. So you'll need your status to have that prefix. Or... you can modify the querystring with a later filter:
function woocommerce_reports_get_order_report_query_filter( $query ){ $custom_status = 'custom_status'; $query['where'] = substr_replace( $query['where'], $custom_status , strpos( $query['where'], 'wc-' . $custom_status), strlen('wc-' . $custom_status) ); return $query;}add_filter( 'woocommerce_reports_get_order_report_query', 'woocommerce_reports_get_order_report_query_filter' );
All this filter code gets added to your theme functions.php
or custom plugin code.
Filters are applied here, which will allow you to alter term.slug
however you'd like.
In a custom plugin (or functions.php of your theme), add a filter:
function override_order_report_data_terms($slug_array) { return array('custom_status');}add_filter('woocommerce_reports_order_statuses', 'override_order_report_data_terms');
Read more about add_filter()
in the Codex.