This plugin improves WooCommerce performance by introducing a custom table to hold all of the most common order information in a single, properly-indexed location.
WooCommerce 3.0 introduced the notion of CRUD (Create, Read, Update, and Delete) interfaces in a move to unify the way WooCommerce data is stored and retrieved. However, orders are still stored as custom post types within WordPress, with each piece of order information (billing address, shipping address, taxes, totals, and more) being stored in post meta.
In fact, WooCommerce will typically create over 40 separate post meta entries for every single order. If your store receives even 10 orders a day, that means 400 new rows in the table every single day!
The larger the post meta table grows, the longer queries will take to execute, potentially slowing down queries (and thus page load times) for you and your visitors.
WooCommerce Custom Orders Table uses the WooCommerce CRUD design to save order data into a single, flat table that's optimized for WooCommerce queries; one order means only one new row, with minimal performance impact.
WooCommerce Custom Orders Table requires WooCommerce 3.5.1 or newer.
If you're looking to migrate existing order data, you'll need to have the ability to run WP-CLI commands in your WooCommerce environment.
After installing and activating the plugin, you'll need to migrate orders from post meta into the newly-created orders table.
The easiest way to accomplish this is via WP-CLI, and the plugin ships with three commands to help:
If you'd like to see the number of orders that have yet to be moved into the orders table, you can quickly retrieve this value with the
$ wp wc orders-table count
migrate command will flatten the most common post meta values for WooCommerce orders into a flat database table, optimized for performance.
$ wp wc orders-table migrate
Orders are queried in batches (determined via the
--batch-size option) in order to reduce the memory footprint of the command (e.g. "only retrieve
$size orders at a time"). Some environments may require a lower value than the default of 100.
Please note that
migrate will delete the original order post meta rows after a successful migration. If you want to preserve these, include the
If you require the post meta fields to be present (or are removing the custom orders table plugin), you may rollback the migration at any time with the
$ wp wc orders-table backfill
This command does the opposite of
migrate, looping through the orders table and saving each column into the corresponding post meta key. Be aware that this may dramatically increase the size of your post meta table!
If you're interested in contributing to the development of the plugin or need to report an issue, please see the contributing guidelines for the project.