Include "variation = 0" orders in variation report data.

This catches simple products with sales that have been converted to variable.
This commit is contained in:
Jeff Stieler 2019-08-17 10:16:54 -07:00
parent 90edd4e5a6
commit 60ff4fc067
1 changed files with 2 additions and 3 deletions

View File

@ -138,7 +138,6 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
if ( $order_status_filter ) {
$sql_query_params['from_clause'] .= " JOIN {$wpdb->prefix}wc_order_stats ON {$order_product_lookup_table}.order_id = {$wpdb->prefix}wc_order_stats.order_id";
$sql_query_params['where_clause'] .= " AND ( {$order_status_filter} )";
$sql_query_params['where_clause'] .= ' AND variation_id > 0';
}
return $sql_query_params;
@ -289,7 +288,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
{$sql_query_params['where_time_clause']}
{$sql_query_params['where_clause']}
GROUP BY
variation_id
product_id, variation_id
) AS tt"
); // WPCS: cache ok, DB call ok, unprepared SQL ok.
@ -317,7 +316,7 @@ class DataStore extends ReportsDataStore implements DataStoreInterface {
{$sql_query_params['where_time_clause']}
{$sql_query_params['where_clause']}
GROUP BY
variation_id
product_id, variation_id
{$suffix}
{$right_join}
{$sql_query_params['outer_from_clause']}