I have two orders, one of which has been refunded.
Order 1 = $9.89. Fully refunded.
Order 2= $4.94. Complete.
Here's how the Customers Reports look:
The query that's running for EDD\Stats::get_customer_lifetime_value() is:
SELECT AVG(total) AS total
FROM (
SELECT SUM(total) AS total
FROM wp_edd_orders
WHERE 1 = 1
AND wp_edd_orders.status IN ('complete', 'revoked')
AND wp_edd_orders.date_created >= '2021-05-05 00:00:00'
AND wp_edd_orders.date_created <= '2021-06-04 23:59:59'
GROUP BY customer_id
) o
The problem is that it's picking up the completerefund record, but not the refundedorder record and it's making the numbers all weird.
I think what we should be doing is setting wp_edd_orders.type = 'sale' and the statuses should be the gross order statuses.
Information (if a specific version is affected):
PHP Version:
EDD Version (or branch): release/3.0
WordPress Version:
Any other relevant information: This is milestoned for after 3.0 because it's not a blocker for 3.0 launch.
Bug Report
Expected behavior
I have two orders, one of which has been refunded.
Here's how the Customers Reports look:
The query that's running for
EDD\Stats::get_customer_lifetime_value()
is:The problem is that it's picking up the
complete
refund record, but not therefunded
order record and it's making the numbers all weird.I think what we should be doing is setting
wp_edd_orders.type = 'sale'
and the statuses should be the gross order statuses.Information (if a specific version is affected):
PHP Version:
EDD Version (or branch): release/3.0
WordPress Version:
Any other relevant information: This is milestoned for after 3.0 because it's not a blocker for 3.0 launch.