Automattic\WooCommerce\Admin\API\Reports
DataStore::get_customer_subquery
Returns customer subquery to be used in WHERE SQL query, based on query arguments from the user.
Method of the class: DataStore{}
No Hooks.
Returns
string.
Usage
// protected - for code of main (parent) or child class $result = $this->get_customer_subquery( $query_args );
- $query_args(array) (required)
- Parameters supplied by the user.
DataStore::get_customer_subquery() DataStore::get customer subquery code WC 11.1.2
protected function get_customer_subquery( $query_args ) {
global $wpdb;
$customer_filter = '';
if ( isset( $query_args['customer_type'] ) ) {
if ( 'new' === strtolower( $query_args['customer_type'] ) ) {
$customer_filter = " {$wpdb->prefix}wc_order_stats.returning_customer = 0";
} elseif ( 'returning' === strtolower( $query_args['customer_type'] ) ) {
$customer_filter = " {$wpdb->prefix}wc_order_stats.returning_customer = 1";
}
}
return $customer_filter;
}