Reports: Don't include auto-draft orders in reports

We use auto-draft in the the API
(https://github.com/woocommerce/woocommerce/pull/31290) and to some
extent in wp-admin. These orders should not impact reporting.

Fixes https://github.com/woocommerce/woocommerce-ios/issues/6626
This commit is contained in:
Josh Betz 2022-04-13 14:43:51 -05:00
parent f3865ca543
commit f384581e67
1 changed files with 1 additions and 1 deletions

View File

@ -577,7 +577,7 @@ class DataStore extends SqlQuery {
*/
protected static function get_excluded_report_order_statuses() {
$excluded_statuses = \WC_Admin_Settings::get_option( 'woocommerce_excluded_report_order_statuses', array( 'pending', 'failed', 'cancelled' ) );
$excluded_statuses = array_merge( array( 'trash' ), array_map( 'esc_sql', $excluded_statuses ) );
$excluded_statuses = array_merge( array( 'auto-draft', 'trash' ), array_map( 'esc_sql', $excluded_statuses ) );
return apply_filters( 'woocommerce_analytics_excluded_order_statuses', $excluded_statuses );
}