Woocommerce-admin: Renewal orders not included on Analytics

Created on 11 Jun 2019  路  22Comments  路  Source: woocommerce/woocommerce-admin

Describe the bug
Support forum thread: https://wordpress.org/support/topic/analytics-is-incomplete/

I checked my dev install and there is no indication that a renewal order from December was imported into the analytics data.

I'll clear my analytics data and re-run the import then update this with my findings.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

analytics bug

All 22 comments

I'm not too savvy with renewals, but by chance does the renewal order utilize a custom order status?

by chance does the renewal order utilize a custom order status?

No, they use standard WC statuses.

I cleared my existing imported data then ran the import all again. I tested with the skip existing both checked and unchecked. The renewal orders are now being imported and included in the revenue report.

However, when I changed the rows per page on the revenue report the visible rows with revenue were set to zero.

On Load
Screen Shot 2019-06-12 at 11 32 25 AM

After changing per page

Screen Shot 2019-06-12 at 11 32 55 AM

Closing this as I wasn't able to reproduce with master. Created #2406 for my previous comment.

Hello @rrennick , I originally posted this:
https://wordpress.org/support/topic/analytics-is-incomplete/

The analytics are much closer, but still not matching my WC reports page.

Totals: New Analytics | WC Reports
Gross Revenue/Sales: $71,414.02 | $71,745.30
Refunds: $1,469.60 | $1,138.18
Shipping: $4,260.00 | $4,200.00
Net Revenue/Sales: $67,154.02 | $67,545.30

Also the Customers Analytics still don't include any of the Subscription orders.

@derekakelly Thanks for the followup. My dataset is smaller but I'll see if I can find/reproduce discrepancies in those areas.

i'm going to reopen this as it looks like you are going to investigate further @rrennick

It's also probably worth noting that while comparing the different pages, both the amount of orders and the amount of items sold match.

Maybe partial refunds are to blame?

Also the Customers Analytics still don't include any of the Subscription orders.

I have checked this against master and both parent and renewal subscription orders are included in the customer analytics.

Maybe partial refunds are to blame?

I did a spell of refunds testing a core WC issue. The main test customer I used for that testing matches:

mysql> select sum(meta_value) from wp_postmeta where post_id in (select order_id from wp_wc_order_stats where customer_id = 201) and meta_key = '_order_total';
+--------------------+
| sum(meta_value)    |
+--------------------+
| 2552.3900000000003 |
+--------------------+
1 row in set (0.00 sec)

mysql> select sum(gross_total) from wp_wc_order_stats where customer_id = 201;
+--------------------+
| sum(gross_total)   |
+--------------------+
| 2552.3900000000003 |
+--------------------+
1 row in set (0.00 sec)

The analytics are much closer, but still not matching my WC reports page.

The aggregate data set for the WC reports is cached and doesn't include orders occurring since the last time the raw queries were run. Are you comparing reports up to the current time or historical date ranges?

When I go into my Customers page, my top customer only has 3 orders. So, I looked into a subscription customer's history. They have 48 orders with us and each of these orders was $41.44. Their first order was in 2017, a new subscription parent order, then all renewals and no other orders whatsoever. The Customer Analytics only shows 1 order for $41.44.

I reduced the size of my date range to narrow down the revenue totals issue. I found that my shipping charges were $16 higher and net sales/revenue was $16 lower when compared to my WC Reports, but otherwise accurate. I checked my refunds in that time period and found only 2 orders, each was completely refunded and each had $8 in shipping charges. I wonder if this is a coincidence?

Something @danielbitzer just raised with us is that reports in WC Admin only include data from users with the customer role - WC_Admin_Reports_Customers_Data_Store::is_valid_customer(). Could this be the cause? Customers with active subscriptions have the subscriber role by default.

Something @danielbitzer just raised with us is that reports in WC Admin only include data from users with the customer role - WC_Admin_Reports_Customers_Data_Store::is_valid_customer(). Could this be the cause? Customers with active subscriptions have the subscriber role by default.

After subscriptions end, the customer is switched back into the customer role. I have many different customers like this.

So I tried looking up one of these customers and this is the result I got.
https://imgur.com/a/3xH3y0H

The Customers not showing up is a new bug

Customers with active subscriptions have the subscriber role by default.

I just ran a fresh import on master and a Subscriber with orders was imported including the orders.

I found a discrepancy between the WC core reports & the WC Admin reports on partial refunded orders. The report that is accurate is the WC Admin report. If you have an order that has 2 items and you refund 1 of the 2 items, WC marks the order as refunded. The core report shows that order as having no gross revenue.

WC Admin

Screen Shot 2019-06-20 at 4 48 28 PM

WC core

Screen Shot 2019-06-20 at 4 48 46 PM

Order edit

Screen Shot 2019-06-20 at 4 49 14 PM

My orders are still marked as completed when a partial refund is done. You're right about the core reports being off, but the Customer's analytics is off too.

It's probably worth noting that this customer has always placed their orders as a guest.

haffner orders
haffner order details
haffner customer report
haffner customer analytics

Thanks for all the details and help you are offering @derekakelly - much appreciated!

No problem @timmyc I'm happy to help :)

This looks like multiple guest customer records are being created for the same guest account. I'll see if I can reproduce this next week.

I just looked into the customer ID's and I was mistaken. The customer's first order was as a guest and the following two orders were as a registered customer.

The original order has a slightly different spelling of the street address, otherwise the 3 orders have identical customer information.

The customer's first order was as a guest and the following two orders were as a registered customer.

There is a division between orders of guests and orders of logged in customers in the original WC reports that is carried through to these reports. There also might be some GDPR or similar privacy implications of connecting guest accounts to customer accounts. If there is interest in having those connected then we can create a feature request issue.

I'll close this issue as the items described have been fixed. Since this issue covers a range of issues, instead of re-opening this one, create a new issue and add a reference to this issue if another analytics count/total is off.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

justinshreve picture justinshreve  路  3Comments

timmyc picture timmyc  路  4Comments

peterfabian picture peterfabian  路  3Comments

timmyc picture timmyc  路  4Comments

joshuatf picture joshuatf  路  3Comments