From 700b248ac227dafca8504515463894685a42fb33 Mon Sep 17 00:00:00 2001 From: Brian Hogg Date: Fri, 24 Jan 2025 10:35:44 -0500 Subject: [PATCH] Include transactions in net sales regardless of the transaction's order status. Changelog. --- .changelogs/fix_date-range-widget-1.yml | 7 +++++++ .../reporting/widgets/class.llms.analytics.widget.sold.php | 7 +------ 2 files changed, 8 insertions(+), 6 deletions(-) create mode 100644 .changelogs/fix_date-range-widget-1.yml diff --git a/.changelogs/fix_date-range-widget-1.yml b/.changelogs/fix_date-range-widget-1.yml new file mode 100644 index 0000000000..8405ad36e9 --- /dev/null +++ b/.changelogs/fix_date-range-widget-1.yml @@ -0,0 +1,7 @@ +significance: patch +type: fixed +links: + - "#2860" + - "#2861" +entry: Sales reporting includes partially refunded transactions, and + transactions from orders regardless of status. diff --git a/includes/admin/reporting/widgets/class.llms.analytics.widget.sold.php b/includes/admin/reporting/widgets/class.llms.analytics.widget.sold.php index a971636f9e..92e5655696 100644 --- a/includes/admin/reporting/widgets/class.llms.analytics.widget.sold.php +++ b/includes/admin/reporting/widgets/class.llms.analytics.widget.sold.php @@ -69,11 +69,6 @@ public function set_query() { 'select' => array( 'orders.ID', ), - 'statuses' => array( - 'llms-active', - 'llms-completed', - 'llms-refunded', - ), ) ); $this->query(); @@ -112,7 +107,7 @@ public function set_query() { {$txn_meta_join} JOIN {$wpdb->postmeta} AS sales ON sales.post_id = txns.ID WHERE - ( txns.post_status = 'llms-txn-succeeded' ) + ( txns.post_status = 'llms-txn-succeeded' OR txns.post_status = 'llms-txn-refunded' ) AND txns.post_type = 'llms_transaction' AND txns.post_date >= %s AND txns.post_date < %s