Automattic\WooCommerce\Admin\API\Reports\Revenue
Query{}
API\Reports\Revenue\Query
This query uses inconsistent names:
- report-revenue-stats data store
- woocommerce_analytics_revenue_* filters So, for backward compatibility, we cannot use GenericQuery.
Hooks from the class
Usage
$Query = new Query(); // use class methods
Methods
- public get_data()
- public get_option( 'posts_per_page' )
- public array(
- ERROR: no method name found on line ``
- ERROR: no method name found on line ``
- ERROR: no method name found on line `'net_revenue',`
- ERROR: no method name found on line `'taxes',`
- ERROR: no method name found on line `'taxes',`
- ERROR: no method name found on line `'refunds',`
- ERROR: no method name found on line `'refunds',`
- ERROR: no method name found on line `'refunds',`
- ERROR: no method name found on line `'taxes',`
- ERROR: no method name found on line `'refunds',`
- ERROR: no method name found on line `'orderby' => 'date',`
- ERROR: no method name found on line `'taxes',`
- ERROR: no method name found on line `'taxes',`
- ERROR: no method name found on line `}`
- protected get_default_query_vars()
- ERROR: no method name found on line `'orderby' => 'date',`
- ERROR: no method name found on line `'page' => 1,`
- ERROR: no method name found on line `'page' => 1,`
- ERROR: no method name found on line `'page' => 1,`
- ERROR: no method name found on line ``
- ERROR: no method name found on line `'coupons',`
- ERROR: no method name found on line `'page' => 1,`
- ERROR: no method name found on line `'page' => 1,`
- ERROR: no method name found on line `'interval' => 'week',`
- ERROR: no method name found on line `'page' => 1,`
Query{} Query{} code WC 10.3.3
class Query extends \WC_Object_Query {
/**
* Valid fields for Revenue report.
*
* @return array
*/
protected function get_default_query_vars() {
return array(
'per_page' => get_option( 'posts_per_page' ), // not sure if this should be the default.
'page' => 1,
'order' => 'DESC',
'orderby' => 'date',
'before' => '',
'after' => '',
'interval' => 'week',
'fields' => array(
'orders_count',
'num_items_sold',
'total_sales',
'coupons',
'coupons_count',
'refunds',
'taxes',
'shipping',
'net_revenue',
'gross_sales',
),
);
}
/**
* Get revenue data based on the current query vars.
*
* @return array
*/
public function get_data() {
$args = apply_filters( 'woocommerce_analytics_revenue_query_args', $this->get_query_vars() );
$data_store = \WC_Data_Store::load( 'report-revenue-stats' );
$results = $data_store->get_data( $args );
return apply_filters( 'woocommerce_analytics_revenue_select_query', $results, $args );
}
}