Title: Bug Order Count WooCommerce Analytics
Last modified: September 24, 2021

---

# Bug Order Count WooCommerce Analytics

 *  Resolved [henrikgda](https://wordpress.org/support/users/henrikgda/)
 * (@henrikgda)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/)
 * Hi,
 * I tried re-importing my analytics data. But it still shows incorrect order count.
   According to WooCommerce Analytics, I have 12000 orders. But in reality, I have
   8300 orders. The importer function also shows 8300 orders, but the graph shows
   1200 with incorrect revenue totals.
 * Can I reset the analytics data? Because data in Reports is correct. But not in
   the newly developed analytics.
 * Let me know!
 * Best regards,
    Henrik

Viewing 13 replies - 1 through 13 (of 13 total)

 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14907092)
 * Hey [@henrikgda](https://wordpress.org/support/users/henrikgda/),
 * I have not been able to replicate on my test site what you have experienced on
   your site. Orders count and Analytics Orders totals perfectly match as you can
   see here:
 * 
    Link to image: [https://i.imgur.com/IHXhKwW.png](https://i.imgur.com/IHXhKwW.png)
 * —
 * 
    Link to image: [https://i.imgur.com/Qm2lhiZ.png](https://i.imgur.com/Qm2lhiZ.png)
 * Under Analytics Settings > Excluded Statuses all statuses are disabled:
 * 
    Link to image: [https://snipboard.io/6lbQky.jpg](https://snipboard.io/6lbQky.jpg)
 * What you can do is clear Analytics Cache from `WooCommerce > Status > Tools`,
   go back to Analytics Settings and delete previously imported data. At that point,
   import historical data and check again.
 * Let us know how it goes.
 *  Thread Starter [henrikgda](https://wordpress.org/support/users/henrikgda/)
 * (@henrikgda)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14911239)
 * Hi Mirko,
 * I was told that already, and did so. But the result hasn’t changed. It does show
   importing 0 of 8300. But after importing, it still shows 12.000 in Analytics.
 * So does it really do a clear refresh? Because if you have 12000 already, updating
   8300 orders wouldn’t change the total count.
 * Importing:
 * Order overview:
 * Analytics:
 * Is the analytics data stored in the database? Or where does it get this number
   from? Because importing the historical data nor clearing the analytics cache 
   worked for me.
 *  [MayKato](https://wordpress.org/support/users/maykato/)
 * (@maykato)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14929046)
 * Hi [@henrikgda](https://wordpress.org/support/users/henrikgda/)
 * Could you temporarily switch your theme to [Storefront](https://wordpress.org/themes/storefront/),
   disable all plugins except for WooCommerce, and check if the analytics shows 
   the correct number?
 *  Thread Starter [henrikgda](https://wordpress.org/support/users/henrikgda/)
 * (@henrikgda)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14934415)
 * Hi [@maykato](https://wordpress.org/support/users/maykato/),
 * Switched to Storefront:
 * ![](https://i0.wp.com/snipboard.io/zFTN9L.jpg?ssl=1)
 * And disabled all other plugins:
 * ![](https://i0.wp.com/snipboard.io/oxgLDP.jpg?ssl=1)
 * But still doesn’t show correct order count:
 * ![](https://i0.wp.com/snipboard.io/lLsMyE.jpg?ssl=1)
 * Maybe good to note that in this installation, I’ve migrated about 70% of the 
   orders from the old shop into the new shop using this plugin:
    [https://wordpress.org/plugins/order-import-export-for-woocommerce/](https://wordpress.org/plugins/order-import-export-for-woocommerce/)
 * But that shouldn’t affect the order count right?
 * I can send you credentials if you want a look around yourselves.
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14936353)
 * Hello [@henrikgda](https://wordpress.org/support/users/henrikgda/),
 * Thanks for getting back to us.
 * You can use the following query in your database in order to load the WooCommerce
   orders and check the total number:
 *     ```
       SELECT ID, post_author, post_date, post_status, post_type FROM wp_posts
       WHERE post_type = 'shop_order'
       ```
   
 * 
    Link to image: [https://i.imgur.com/5WQrrZ5.png](https://i.imgur.com/5WQrrZ5.png)
 * —
 * 
    Link to image: [https://i.imgur.com/tx6z43Z.png](https://i.imgur.com/tx6z43Z.png)
 * When you delete orders in `WooCommerce > Orders` and clear the trash, all data
   from `Analytics > Orders` should also get removed. Do not forget to clear transients
   and analytics cache within `WooCommerce > Status > Tools`.
 * ** Before deleting orders you may want to export them with a tool/plugin so you
   can import them back later **
 * Also, make sure you have a full backup of your site and database in place before
   any making any changes. Use a free plugin like [UpdraftPlus](https://wordpress.org/plugins/updraftplus/).
   If something goes wrong it’s nice to know that you can restore your site to the
   previous state.
 * Cheers.
 *  Thread Starter [henrikgda](https://wordpress.org/support/users/henrikgda/)
 * (@henrikgda)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14938101)
 * Hi Mirko,
 * SQL Query also gives me same result as on the orders overview page.
 * ![](https://i0.wp.com/snipboard.io/7KMOLU.jpg?ssl=1)
 * ![](https://i0.wp.com/snipboard.io/f9VjOK.jpg?ssl=1)
 * But Analytics count is still different.
 * Please note that this is AFTER clearing the analytics cache and transients.
 * ![](https://i0.wp.com/snipboard.io/GLWe30.jpg?ssl=1)
 * Because it’s a production environment, I can’t just delete all orders and re-
   import them.
 * Good to note that the order count is CORRECT in the ‘old’ reports section. See:
 * ![](https://i0.wp.com/snipboard.io/0iK6v3.jpg?ssl=1)
 * **The thing is that the number is incorrect in the period of year-to-date**. 
   When I select last month, the numbers are correct. But not over a longer period
   of time. Why is that? ‘Reports’ can handle it just fine.
 * Best regards.
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14943999)
 * Hi [@henrikgda](https://wordpress.org/support/users/henrikgda/),
 * Thanks for checking the database.
 * Could it be that you’ve set a Personal Data Retention under WooCommerce > Settings
   > Accounts & Privacy so that data is removed after a certain period?
 * 
    Link to image: [https://i.imgur.com/VJSGIVX.png](https://i.imgur.com/VJSGIVX.png)
 *  [Mirko P.](https://wordpress.org/support/users/rainfallnixfig/)
 * (@rainfallnixfig)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14968477)
 * Hi there,
 * We haven’t heard back from you in a while, so I’m going to mark this as resolved–
   we’ll be here if and/or when you are ready to continue.
 *  Thread Starter [henrikgda](https://wordpress.org/support/users/henrikgda/)
 * (@henrikgda)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14968948)
 * Hi Mirko,
 * I didn’t get notified on your reply.
 * Checked the settings, but they’re the same as yours. All empty.
 * What has changed in order count in Analytics verses Reports?
 * Because main question is: why does reports show correct order count, and Analytics
   doesn’t?
 * Best regards
 *  [Austin M – a11n](https://wordpress.org/support/users/apmwebdev/)
 * (@apmwebdev)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14974604)
 * Hi [@henrikgda](https://wordpress.org/support/users/henrikgda/). If you look 
   through the individual orders listed in the Analytics reports, are you able to
   see these extra orders there? Are they duplicate orders, blank orders, or something
   else? It might make sense to look at a specific period of time, like a month,
   to make it easier to narrow down.
 *  Thread Starter [henrikgda](https://wordpress.org/support/users/henrikgda/)
 * (@henrikgda)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-14979284)
 * Hi Austin,
 * Looking at specific months, I see a lot of duplicate order lines. I think that
   might be the cause of the invalid order count.
 * ![](https://i0.wp.com/snipboard.io/Am6RfT.jpg?ssl=1)
 * Link to image: [https://snipboard.io/Am6RfT.jpg](https://snipboard.io/Am6RfT.jpg)
 * So how can I get rid of these duplicates? The ones without order ID?
 *  Plugin Support [lionel.a11n](https://wordpress.org/support/users/lioneldaniel/)
 * (@lioneldaniel)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-15026669)
 * Hello [@henrikgda](https://wordpress.org/support/users/henrikgda/),
 * I’m sorry that you’re still experiencing this problem.
 * > What has changed in order count in Analytics verses Reports?
   > Because main question is: why does reports show correct order count, and Analytics
   > doesn’t?
 * I’m sorry you’re still experiencing an issue here. It does appear there is an
   error that doesn’t occur on any of our test sites, possibly due to how the orders
   were imported.
 * One thing to check is whether your reports table has order rows which don’t match
   any actual order numbers in your database. Could you try a query similar to this
   to see if that is the case? If so, deleting these extra rows may resolve the 
   error:
 * `SELECT * from wp_wc_order_stats where \`order_id\` not in (select \`ID\` from
   wp_posts where \`post_type\` = 'shop_order');`
 * I recommend any changes you make are either on a test site or during a maintenance
   period with after a full backup.
 * If that doesn’t reveal an issue, could you answer some questions?
    - When you checked your analytics view without your theme or any other plugins
      active, did you clear the transients and analytics cache, then re-import your
      data as under those conditions?
    - If you have a staging site, can you replicate the issue by importing products
      using the same tool? If so, can you try a different import tool to see if 
      the issue recurs?
 * Thanks for considering my suggestions, and I hope we can get to the bottom of
   this. We look forward to hearing back from you!
    -  This reply was modified 4 years, 6 months ago by [lionel.a11n](https://wordpress.org/support/users/lioneldaniel/).
      Reason: Repair SQL code formatting
 *  Thread Starter [henrikgda](https://wordpress.org/support/users/henrikgda/)
 * (@henrikgda)
 * [4 years, 6 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-15033014)
 * Hi Lionel,
 * Deleting these extra rows solved the issue! Thanks a ton!
 * Cheers

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Bug Order Count WooCommerce Analytics’ is closed to new replies.

 * ![](https://ps.w.org/woocommerce/assets/icon.svg?rev=3234504)
 * [WooCommerce](https://wordpress.org/plugins/woocommerce/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/woocommerce/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/woocommerce/)
 * [Active Topics](https://wordpress.org/support/plugin/woocommerce/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/woocommerce/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/woocommerce/reviews/)

## Tags

 * [reports](https://wordpress.org/support/topic-tag/reports/)

 * 13 replies
 * 5 participants
 * Last reply from: [henrikgda](https://wordpress.org/support/users/henrikgda/)
 * Last activity: [4 years, 6 months ago](https://wordpress.org/support/topic/bug-order-count-woocommerce-analytics/#post-15033014)
 * Status: resolved