2022 Nov BFCM Marketplace Sale

  1. Documentation /
  2. High-Performance Order Storage

High-Performance Order Storage

High-Performance Order Storage (HPOS) also previously known as “Custom Order Tables” is a solution that provides an easy-to-understand and solid database structure – specifically designed for eCommerce needs. It uses the WooCommerce CRUD design to store order data in custom tables – optimized for WooCommerce queries with minimal impact on the store’s performance. 

In January, we published the initial plan for the Custom Order Tables feature and since then, we’ve been working hard to bring the High-Performance Order Storage (HPOS) to WooCommerce Core. In May, we invited you to test the order migration process and provide feedback on how our initial work performs on real stores of varied configurations.

Now, in WooCommerce 7.1, High-Performance Order Storage (HPOS) will be available to all WooCommerce stores as an opt-in feature.

High-Performance Order Storage is available as an opt-in feature in WooCommerce 7.1. It will be included in WooCommerce Core next year. Please find the links to all the chapters in the initial progress report.

What’s New with High-Performance Order Storage?

↑ Back to top

Bringing High-Performance Order Storage (HPOS) to WooCommerce improves these three essential properties for eCommerce stores. 

  1. Scalability

The rise in the number of customers and customer orders increases the load on your store’s database – making it difficult to handle customer order requests and deliver a seamless user experience.

With High-Performance Order Storage, you get dedicated tables for data like orders and order addresses and thus dedicated indexes which results in fewer read/write operations and fewer busy tables. This feature enables eCommerce stores of all shapes and sizes to scale their business to their maximum potential – without expert intervention. 

  1. Reliability 

High-Performance Order Storage makes implementing and restoring targeted data backup easier. You’ll no longer need to worry about losing orders, inventory numbers, or client information with reliable backup in these custom order tables. It’ll also facilitate implementing read/write locks and prevent race conditions.

  1. Simplicity 

You no longer have to go through a single huge database to locate underlying data and WooCommerce entries. 

With High-Performance Order Storage, you can easily browse through the separate tables and easy-to-handle entries, independent of the table wp_posts, to find data or understand the table structure. It also lets you easily develop new plugins, implement designs for shops and products, and modify WooCommerce with more flexibility.

Enable High-Performance Order Storage

↑ Back to top

You can enable the High-Performance Order Storage feature from WooCommerce > Settings > Advanced > Features

Once it is enabled, a new setting section will appear called “Custom Data Stores” under WooCommerce > Settings > Advanced

Custom Data Stores

↑ Back to top

First, please make sure that you have enabled HPOS from WooCommerce > Settings > Advanced > Features. Only after that, the Custom Data Stores will appear under WooCommerce > Settings > Advanced.

When you visit this screen for the first time, it will prompt you to create the custom tables by going to WooCommerce > Status > Tools and running Create the custom orders tables.

Once the tables are ready, you can configure the usage of the HPOS tables.

You can switch between data stores freely to sync the data between the tables.

  • If you select “Use WooCommerce order tables” and “Keep the post tables and the order tables synchronized”, the system will sync the order data between the posts/postmeta and new custom order tables (WooCommerce tables).

Please note that switching between tables is not possible when the posts/postmeta and the new tables are in sync. This means you’ll need to wait for the initial sync to finish before you’d be able to switch:

Switching data storage is disabled when orders are syncing

If plugins are interacting with order data via the WooCommerce-provided WC_Order class, then the transition should be seamless, and the data source in use should be transparent.

If any plugins interact with posts and postmeta directly, they should still work without issue as the synchronization will update the data. However, these plugins will need to be updated as we plan to stop the synchronization to posts/postmeta tables next year.

Note: If you are using a third-party extension that isn’t working properly with High-Performance Order Storage then please notify the developers of the extension and ask them to update their extension to add support for HPOS. It’s up to the extension developers to add support for HPOS. We have developer resources and documentation available to help with their integration efforts.

Synchronization is an option that can also be turned off, so once the store admin is confident that all plugins are working successfully, they can disable the sync process and realize the full performance gains of HPOS tables.

Synchronization

↑ Back to top

Once the HPOS feature and synchronization are enabled, WC populates the HPOS tables with data from posts & postmeta tables. The synchronization between the tables is explained in detail in this document.

Verification

↑ Back to top

On the fly

↑ Back to top

To make the troubleshooting of potential problems encountered during sync easier, we’ve also updated the code that reads orders to read both data sources and compare the data, logging all discrepancies. This is very handy for making sure orders are in sync (in case no discrepancies have been reported) and allows us to debug potential problems more easily when bugs get reported back to us.

En masse

↑ Back to top

In addition to on-the-fly verification, we created a CLI tool that allows site owners to verify the consistency of the sync. This tool compares all the data between the posts/postmeta and the HPOS tables and reports all the differences to the standard output. To run this tool, execute wp wc cot verify_cot_data in the wp-cli environment.

Transactions

↑ Back to top

We’ve added support to run each synchronization batch to the HPOS tables inside a transaction to ensure data consistency. We’d be interested to hear from you if you encounter any issues (please report it in the WooCommerce GitHub repository) running both with and without the transactions enabled.

This can be enabled in the HPOS feature settings, along with the required transaction isolation level:

Compatibility

↑ Back to top

We understand that breaking stores with any change is unacceptable. This is also our main guiding principle when designing the High-Performance Order Storage (HPOS) and so we attempted to minimize the negative impact of this change as much as possible. Since not all plugins migrated to and use the CRUD layer introduced in WooCommerce 3.0 in 2017, it was apparent that we need to provide a solution that wouldn’t break for customers using those plugins, but would also motivate plugin developers to invest in updating their plugins.

The main mitigations we put in place are:

  1. The HPOS feature will be available as an opt-in experience in WooCommerce 7.1 so that no store should break on the WooCommerce plugin update.
  2. Order data is synchronized (duplicated) between the  wp_posts/wp_postmeta tables and the HPOS tables by default when the Custom Data Stores feature is enabled.
  3. Order id in the new table is always equal to the post id in the wp_posts table.

This means that once the HPOS feature is rolled out, merchants would be able to switch between the posts/postmeta tables and HPOS tables as authoritative tables.

Frequently Asked Questions

↑ Back to top

You can find the full list of FAQs here in our developer documentation.

WooCommerce

The most customizable eCommerce platform for building your online business.

  • 30-day money-back guarantee
  • Support teams across the world
  • Safe and secure online payment