In a recent Business Bloomer Club Slack thread, a developer encountered a frustrating issue while editing WooCommerce orders from the WordPress admin.
The website, recently migrated from an outdated version and updated with all the latest plugins, was running fine—until it came to editing orders.
The admin page would hang indefinitely unless the wc_customer_lookup table was cleared. With over 500,000 orders in the system, this prompted a deeper look into WooCommerce lookup tables and how they affect performance.
What Is the wc_customer_lookup Table?
The wc_customer_lookup table is one of several lookup tables introduced by WooCommerce to enhance performance, especially in large stores. Its primary function is to improve the efficiency of queries involving customer data, which would otherwise require expensive joins across the wp_users and wp_usermeta tables.
Here’s what it’s used for:
- Faster filtering and sorting of customers in reports and admin screens
- More efficient analytics and customer search functionality
- Reducing query complexity in functions like
search_orders()andget_customer_by_id() - Easier anonymization and deletion of customers when needed
Lookup tables are automatically maintained by WooCommerce and used internally by functions that retrieve customer and order data.
The Issue with Editing Orders
In this case, the site admin found that clearing the wc_customer_lookup table dramatically improved the speed of the admin order edit screen. However, this is a temporary solution—WooCommerce will repopulate the table, and the issue may reappear.
This suggests that the problem might be linked to:
- Poor indexing or bloating of the
wc_customer_lookuptable - A mismatch between orders and the corresponding lookup entries after migration
- Background processes triggered when editing an order trying to update or query the lookup table
For large datasets, these operations can become very slow, especially if customer data hasn’t been synced properly.
Cleaning Up Old Orders
Given the order count (~500,000), a logical next step would be to clean up outdated or unnecessary order records. The developer asked about safe ways to delete old orders without breaking relationships in the database.
Here are a few suggestions:
- Use WP CLI, which allows you to run efficient database-level deletions with command-line tools like:
wp post delete $(wp post list --post_type='shop_order' --posts_per_page=500 --format=ids) --force(Make sure to backup your database first.) - Develop a custom cleanup tool, especially if you want to delete based on custom conditions like order status or date.
Conclusion
WooCommerce lookup tables are meant to speed things up—but in edge cases like large, migrated sites, they can contribute to performance issues if not properly maintained.
In this case, optimizing or cleaning the wc_customer_lookup table and reducing the overall order volume seem to be the key steps toward fixing a sluggish admin order editor.
Regular maintenance of lookup tables and archiving older data can go a long way in keeping large WooCommerce stores running smoothly.








