Title: Client histories wrong
Last modified: May 20, 2026

---

# Client histories wrong

 *  Resolved [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [3 weeks, 1 day ago](https://wordpress.org/support/topic/client-histories-wrong/)
 * Hi, after moving a Woocommerce store, the Client History data (on Order pages)
   is incorrect. Some show multiple purchases where there should be only one, some
   show NO purchases where there should be at least the current one.
 * Is there any way to rebuild/recalculate this type of data?

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

 *  [LovingBro (woo-hc)](https://wordpress.org/support/users/lovingbro/)
 * (@lovingbro)
 * [3 weeks, 1 day ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18913795)
 * Hi [@ravanh](https://wordpress.org/support/users/ravanh/),
 * Thanks for reaching out about this. That does sound unusual, especially if the
   customer purchase counts changed after the store migration.
 * WooCommerce calculates the “Customer history” data based on the orders linked
   to a customer account or billing email, so if something changed during the migration,
   such as user IDs, order associations, or duplicated data, it could affect the
   counts being shown.
 * To help narrow this down, could you let us know:
    1. Was the site migrated to a new domain, server, or both?
    2. Did you use a migration plugin or restore from a backup?
    3. Have you already tried a conflict test by temporarily disabling all plugins 
       except WooCommerce and switching to a default theme like Twenty Twenty-Four 
       to see if the counts change?
    4. Are the affected orders linked to registered customer accounts, guest orders,
       or both?
 * Also, please share your WooCommerce System Status Report so we can take a closer
   look: [https://woocommerce.com/document/understanding-the-woocommerce-system-status-report/](https://woocommerce.com/document/understanding-the-woocommerce-system-status-report/)
 * You can paste it via [https://pastebin.com](https://pastebin.com) or [https://quickforget.com](https://quickforget.com)
   and share the link here.
 *  Thread Starter [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [3 weeks, 1 day ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18913896)
 * Hi,
    1. Was the site migrated to a new domain, server, or both?
 * New server.
    1. Did you use a migration plugin or restore from a backup?
 * Restore from a backup, but also a manual import of latest orders that occurred
   during the migration. I suspect it went wrong there…
    1. Have you already tried a conflict test by temporarily disabling all plugins 
       except WooCommerce and switching to a default theme like Twenty Twenty-Four 
       to see if the counts change?
 * I tried the Health Check & Troubleshooting plugin, with only Woocommerce reactivated.
   The History calculations are still wrong then. The weird thing: only 922 of the
   current 1430 orders appear on the Orders admin page. Is this a hint of what could
   be wrong?
    1. Are the affected orders linked to registered customer accounts, guest orders,
       or both?
 * Both. I notice guest orders often show 0 orders in their history while registered
   show too many. But even for those that have the correct order number, the average
   and total amounts are wrong.
 * My report on pastebin [https://pastebin.com/7dv6btGy](https://pastebin.com/7dv6btGy)
 *  [LovingBro (woo-hc)](https://wordpress.org/support/users/lovingbro/)
 * (@lovingbro)
 * [3 weeks, 1 day ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18914195)
 * Hi [@ravanh](https://wordpress.org/support/users/ravanh/),
 * Thanks for sharing those additional details and the System Status Report. The
   fact that only 922 out of 1430 orders are appearing in the Orders admin page 
   is definitely a strong clue here, especially combined with the incorrect customer
   history calculations.
 * From what you described, it does sound possible that the manual order import 
   during the migration may have caused inconsistencies between the WooCommerce 
   order tables and the lookup tables WooCommerce uses for customer statistics and
   order history.
 * I also noticed from your report that HPOS is enabled on the site. Since HPOS 
   stores orders in dedicated WooCommerce tables, partial imports or mismatched 
   sync data can sometimes lead to symptoms like:
 * • Incorrect customer order counts
   • Wrong average or total spent values• Guest
   orders not being linked correctly• Missing orders in the admin Orders list
 * To start narrowing this down further, could you please check the following:
    1. Go to WooCommerce → Status → Tools
    2. Run these tools one at a time: 
       • Regenerate the product lookup tables• Recount
       terms• Clear analytics cache
    3. Then check under: WooCommerce → Settings → Advanced → Features
 * Please temporarily disable HPOS compatibility mode if enabled, save changes, 
   then re-enable it and allow WooCommerce to resync the order data.
    4. Also, can you confirm: 
       • Were the manually imported orders imported directly
       into the database, or through a plugin/tool?• Do the “missing” orders still 
       exist in the wp_wc_orders table and wp_posts table, or only one of them?
 * Since the issue persists even in Health Check troubleshooting mode, this is looking
   less like a plugin conflict and more like a data synchronization or migration
   inconsistency.
 * Let us know what you find after the above checks and we’ll continue from there.
 *  Thread Starter [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [3 weeks ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18914395)
 * Ok, I ran the Tools and disabled **HPOS Data Caching** option (is that what you
   meant with HPOS compatibility mode?) but the order history calculations are still
   off.
 * I do remember that we switched from Legacy to High-performance order storage 
   after the move. Could that have caused this?
 * HPOS Data Caching was switched on because there is a Redis Object Cache on the
   new hosting environment.
 * We did a manual db import of the woocommerce order and customer tables but also
   a export/import via the WordPress export tool because we noticed a weird issue
   where some of the latest orders could not be selected (no check box) on the Orders
   overview admin page.
 * About the “missing” orders on the Orders overview admin page: this only happens
   when in Health Check troubleshooting mode. Then there appear only (today) 923
   orders instead of 1,431 without troubleshooting mode.
 * I compared the wp_wc_orders table and wp_posts tables:
    - `wp_posts` has 1524 entries with post type `shop_order`
    - `wc_orders` has 1431 entries with type `shop_order`
 * The orders that go missing in Health Check troubleshooting mode, are present 
   in both the wp_wc_orders table and wp_posts tables. In fact, there appear to 
   be 93 more in the wp_posts table. This may well correspond with the number of
   orders that occurred between the first and the final export/import before switching
   to the new hosting platform… No idea though, how they would be “doubled” during
   the process.
 *  Plugin Support [Frank Remmy (woo-hc)](https://wordpress.org/support/users/frankremmy/)
 * (@frankremmy)
 * [2 weeks, 6 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18916033)
 * Hi [@ravanh](https://wordpress.org/support/users/ravanh/),
 * Thanks for the detailed investigation. Those database comparisons are really 
   useful!
 * The 93 extra orders in `wp_posts` compared to `wc_orders` is the core of the 
   problem. Those are orders that exist in the legacy post-based storage but never
   made it into the HPOS `wc_orders` table; almost certainly the orders that were
   imported during the migration window before you switched to HPOS. Because HPOS
   reads from `wc_orders`, those 93 orders are effectively invisible to it, but 
   they’re still being counted in some of the customer lookup data, which is why
   order counts and totals are coming out wrong.
 * The switch from Legacy to HPOS after the migration also means the sync between
   the two tables was never completed properly for those orders.
 * Here’s what to try:
    - Go to WooCommerce → Settings → Advanced → Features, enable “Enable compatibility
      mode,” and click “Resync order now”: [https://share.zight.com/jkuGwqEG](https://share.zight.com/jkuGwqEG).
      This will trigger WooCommerce to sync the legacy `wp_posts` orders into `wc_orders`,
      which should bring those 93 missing orders across. Leave it running until 
      the sync completes.
    - Once the sync is complete, go to WooCommerce → Status → Tools and run “Update
      database” followed by “Regenerate the product lookup tables”. This will rebuild
      the `wc_customer_lookup` and `wc_order_stats` tables from the corrected order
      data, which should fix the wrong counts and totals in customer histories.
    - Before doing anything with those duplicate orders in `wp_posts`, please take
      a full database backup first. Once the sync is complete, check whether those
      93 entries have been properly brought into `wc_orders`. If they remain as 
      orphaned duplicates after the sync, we can advise on how to safely clean them
      up.
 * On the missing orders in troubleshooting mode (923 vs 1,431): that difference
   is likely because some orders belong to custom statuses registered by plugins
   that are inactive in troubleshooting mode; those orders aren’t gone, they just
   can’t be displayed without the plugin that registered their status. This is a
   separate issue from the history calculations.
 * Let us know how the sync goes!
 *  Thread Starter [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [2 weeks, 2 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18919047)
 * Hi [@frankremmy](https://wordpress.org/support/users/frankremmy/) I did the switch
   to compatibility mode with resync and ran the tools… but the order counts remain
   the same. Some are good, some are too many, and a few are zero.
 * And the 93 difference between the `wp_posts` and `wc_orders` entries remains…
 * I should note: the counts are off even for some orders that occurred after the
   move, in the last few days.
    -  This reply was modified 2 weeks, 2 days ago by [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/).
 *  Plugin Support [Frank Remmy (woo-hc)](https://wordpress.org/support/users/frankremmy/)
 * (@frankremmy)
 * [2 weeks, 2 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18919365)
 * Hi [@ravanh](https://wordpress.org/support/users/ravanh/),
 * Thank you for the update, and the fact that orders placed after the migration
   are also showing incorrect counts is really important. It means this isn’t just
   a legacy data issue but something actively affecting new orders too.
 * Given that Redis object caching is running on your new host, our strong suspicion
   is that the Redis cache is serving stale customer lookup data even after you 
   rebuilt the tables. The rebuild writes correct data to the database, but if Redis
   is still holding old values, WooCommerce reads from cache and nothing appears
   to change.
 * Please try the following:
    - Contact your hosting provider and ask them to flush the Redis object cache
      entirely, or do it yourself via WP-CLI:
 *     ```wp-block-code
       wp cache flush
       ```
   
    - Go to WooCommerce → Status → Tools and run “Regenerate the product lookup 
      tables” again, then check whether customer history counts improve for recent
      orders.
    - Pick one order placed in the last few days that shows wrong counts. Note the
      customer’s billing email, then run this query in phpMyAdmin to check what `
      wc_customer_lookup` has for them:
 *     ```wp-block-code
       SELECT * FROM wp_wc_customer_lookup WHERE email = 'customer@email.com';
       ```
   
 * This will tell us whether the lookup table itself has wrong data or whether it’s
   a cache/display issue.
 * On the 93 orphan orders in `wp_posts`: The HPOS sync silently skipped those, 
   likely because they have incomplete or malformed data from the double-import.
   Those will need to be investigated separately, but let’s fix the active calculation
   issue first.
 * Looking forward to your findings!
 *  Thread Starter [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [2 weeks, 2 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18919577)
 * To make sure, I deactivated the redis object cache completely and then regenerated,
   but still, the history data remains off.
 * I then took the email from the latest order with wrong history data (2 orders
   instead of 1) and checked that against the `wc_customer_lookup` table an it turns
   out to hold only one entry. Did a search for the email from an older order that
   shows 0 orders in the History data and that also showed one entry.
 * But I suppose this is to be expected, because search for an email from a customer
   that has multiple orders that correctly show in his History, also returned only
   one result in the `wc_customer_lookup` table.
 * All customer data there seems to be correct. What does that tell us?
 * I finally found two older orders with 0 in the customer history, where the email
   did _**not**_ return any results from the wc_customer_lookup table. These are
   both from customers that ordered as Guest, while most others (with 0 in history
   but present in the lookup table) have a user account… Not sure if this last info
   is relevant or useful…
 *  Thread Starter [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [2 weeks ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18922277)
 * The weirdest thing: I verified again today and all orders are now showing correct
   client history…
 * I’m 100% sure I turned turned off all caching but even then, the issue remained.
   Now, two days later, the issue has miraculously gone away. Too weird.
 * Anyway, should I leave compatibility mode ON or better to switch that OFF?
 *  Plugin Support [shahzeen(woo-hc)](https://wordpress.org/support/users/shahzeenfarooq/)
 * (@shahzeenfarooq)
 * [1 week, 6 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18922760)
 * Hi there!
 * Thank you for the update. I’m glad to hear that the customer order history is
   now displaying correctly again.
 * It is possible that some form of server-side cache, object cache, scheduled synchronization
   process, or delayed background task was still completing even after the visible
   cache was cleared, which could explain why the issue resolved itself later.
 * Regarding compatibility mode:
 * Even after HPOS appears to be working properly, We recommends keeping compatibility
   mode enabled for some time during the transition period. This provides a safety
   net because both the HPOS tables and the legacy `_posts` tables stay synchronized.
 * Thank you
 *  Thread Starter [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [1 week, 6 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18922852)
 * Ok, perfect. I’ll mark this resolved and I thank you for all your help 🙂
 *  Plugin Support [shahzeen(woo-hc)](https://wordpress.org/support/users/shahzeenfarooq/)
 * (@shahzeenfarooq)
 * [1 week, 6 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18922948)
 * Hi there!
 * Before you go, If you felt supported through the issue, a quick review on WordPress.
   org would mean a lot. It helps others feel confident choosing it, knowing there’s
   help when they need it.
 * You can leave a review here: [https://wordpress.org/support/plugin/woocommerce/reviews/#new-post](https://wordpress.org/support/plugin/woocommerce/reviews/#new-post)
 * Thank you
 *  Thread Starter [Rolf Allard van Hagen](https://wordpress.org/support/users/ravanh/)
 * (@ravanh)
 * [1 week, 6 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18922980)
 * Yep, already left a 5 star review 🙂
 *  Plugin Support [Frank Remmy (woo-hc)](https://wordpress.org/support/users/frankremmy/)
 * (@frankremmy)
 * [1 week, 6 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18923380)
 * Hi Rolf,
 * That’s so kind of you, thank you! 🙏 Don’t hesitate to open a new thread if anything
   else comes up, we’re always happy to help!

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

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fclient-histories-wrong%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](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/)

 * 14 replies
 * 4 participants
 * Last reply from: [Frank Remmy (woo-hc)](https://wordpress.org/support/users/frankremmy/)
 * Last activity: [1 week, 6 days ago](https://wordpress.org/support/topic/client-histories-wrong/#post-18923380)
 * Status: resolved