From 60ff4fc0678ec088fd6dddf86f328a8072655d2f Mon Sep 17 00:00:00 2001 From: Jeff Stieler Date: Sat, 17 Aug 2019 10:16:54 -0700 Subject: [PATCH] Include "variation = 0" orders in variation report data. This catches simple products with sales that have been converted to variable. --- .../src/API/Reports/Variations/DataStore.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/woocommerce-admin/src/API/Reports/Variations/DataStore.php b/plugins/woocommerce-admin/src/API/Reports/Variations/DataStore.php index 8605510845e..b955cf94642 100644 --- a/plugins/woocommerce-admin/src/API/Reports/Variations/DataStore.php +++ b/plugins/woocommerce-admin/src/API/Reports/Variations/DataStore.php @@ -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']}