- What is HPOS (High-Performance Order Storage)?
- Benefits of Making WooCommerce Plugin HPOS Compatible
- How to Make WooCommerce Plugin HPOS Compatible
- Step 1: Understand What Breaks When HPOS Is Enabled
- Step 2: Make Your Plugin's HPOS Compatibility Known
- Step 3: Check if HPOS Is Active (It's Safe)
- Step 4: Replace Direct Database Access With CRUD APIs
- Step 5: Query Orders the HPOS-Safe Way
- Step 6: Check Order Type Correctly
- Step 7: Audit and Update Admin Order Hooks
- Step 8: Register Meta Boxes the Right Way
- Step 9: Testing Your Plugin
- Final Thoughts: Make Your WooCommerce Plugin HPOS-Ready With Confidence
- Frequently Asked Questions (FAQs)
How to Make a WooCommerce Plugin HPOS Compatible: Easy Guide


- What is HPOS (High-Performance Order Storage)?
- Benefits of Making WooCommerce Plugin HPOS Compatible
- How to Make WooCommerce Plugin HPOS Compatible
- Step 1: Understand What Breaks When HPOS Is Enabled
- Step 2: Make Your Plugin's HPOS Compatibility Known
- Step 3: Check if HPOS Is Active (It's Safe)
- Step 4: Replace Direct Database Access With CRUD APIs
- Step 5: Query Orders the HPOS-Safe Way
- Step 6: Check Order Type Correctly
- Step 7: Audit and Update Admin Order Hooks
- Step 8: Register Meta Boxes the Right Way
- Step 9: Testing Your Plugin
- Final Thoughts: Make Your WooCommerce Plugin HPOS-Ready With Confidence
- Frequently Asked Questions (FAQs)
What would be the implications for your WooCommerce plugin in case a store owner switches on HPOS and just then your code stops working? For a good number of the plugin developers, this scenario is not just a theory but the unpleasant reality they have to face.
The transition of WooCommerce towards the High-Performance Order Storage (HPOS) technique has resulted in a complete reorganization of order data, and the older post-based plugins are being wiped out faster, posing serious risks of breaking down, slowing down stores, or displaying critical warnings in the admin area.
The issue is not just a matter of a simple setting change. In case your plugin still relies on wp_posts, wp_postmeta, or custom SQL queries, then HPOS can sneakily interfere with basic functionality—order lookups fail, metadata goes missing, and admin screens behave erratically. As WooCommerce gets nearer to making HPOS the default, turning a blind eye to this transition could result in performance loss, incompatibility, and erosion of user trust.
This tutorial demonstrates how to make a WooCommerce plugin HPOS compatible according to the practices that WooCommerce recommends. You will also find out what HPOS really is, its importance in terms of scalability and performance, and you will get to know the process of gradually updating your plugin through modern CRUD API’s, safe detection methods, and coding patterns that are future-proof and compatible with both legacy and HPOS-enabled stores.
What is HPOS (High-Performance Order Storage)?

To get a full picture of how to make a WooCommerce plugin HPOS compatible, you need to first have a very clear idea of what HPOS is, how it functions, and why it was introduced in WooCommerce.
What Does HPOS Stand for in WooCommerce?
HPOS, which stands for High-Performance Order Storage, is a new WooCommerce architecture that stores order data separately in new, direct database tables instead of using WordPress’s posts and postmeta tables.
To put it even simpler, HPOS clears out the order and post distinction, leading WooCommerce to manage the massive volume of order data more effectively and dependably.
WooCommerce officially represents HPOS as Custom Order Tables, and it is aimed at enhancing performance, scalability, and developer friendliness.
How Orders Were Stored Before HPOS
In the past, WooCommerce always treated orders like WordPress content:
- Orders were saved as
shop_orderentries inwp_posts. - Order meta data was found in
wp_postmeta. - Every query needed multiple joins across large tables.
Thus, the approach was suitable for small stores, but it resulted in serious problems for large stores.
Key Problems With the Old System:
- Slow order queries on large stores
- Massive
wp_postmetatables with millions of rows - Poorly indexed databases for order-related data
- More server load and timeouts
- Difficulties in optimization for enterprise-level WooCommerce stores
These limitations became more and more apparent as the adoption of WooCommerce continued.
What Changes with HPOS in Order Storage?
When HPOS comes into play, WooCommerce uses custom, optimized tables created specially for commerce operations for order data.
Several of the primary HPOS tables comprise:
wc_orders– The principal order datawc_order_addresses– The addresses for billing and shippingwc_order_operational_data– The status of the order, timestamps, and totalswc_orders_meta– Meta data about the custom-made order
In these Tables:
- Indexing is done in a proper manner
- Joins that are not necessary are reduced
- There is a dramatic increase in the speed of queries
WooCommerce performance benchmarks indicate that in high-volume stores, HPOS can enhance the performance of order-related queries by as much as 40%.
Why HPOS Matters for Plugin Developers
In case you are developing or supporting a plugin, HPOS will have a direct effect on your order data reading, writing, and querying processes.
Note: Plugins that make direct access to wp_posts or wp_postmeta for orders will not be able to function properly with HPOS.
This is the reason why grasping HPOS is paramount when you are taught how to make a WooCommerce plugin compatible with HPOS.
What HPOS Requires From Plugins:
- Utilize the WooCommerce CRUD APIs (
wc_get_order()) - Refrain from direct database queries
- Do not rely on
get_post_meta()for orders - Make use of WooCommerce-implemented hooks and filters
Is HPOS on by default?
Currently, HPOS is an optional feature that can be activated from:
WooCommerce → Settings → Advanced → Features
However, WooCommerce has indicated that HPOS is going to be the default order storage system in the upcoming releases. This renders HPOS compatibility a necessity and not just an upgrade of features.
Benefits of Making WooCommerce Plugin HPOS Compatible
Learning how to make the WooCommerce plugin HPOS compatible is not just a matter of avoiding future breakage but rather a way to access performance, scalability, and business advantages that are very real.
Whether you are creating a commercial plugin or serving a custom solution for clients, HPOS compatibility will directly affect the reliability and competitiveness of your plugin.
Let’s go through each of the most significant benefits in a simple but developer-focused manner.
1. Future-Proof Your WooCommerce Plugin
WooCommerce has given a clear message: HPOS is the future of order storage.
Plugins that are not HPOS-ready can:
- Show compatibility warnings in the admin dashboard
- Be banned as incompatible automatically
- Lose faith in the retailers
- Eventually cease functioning as expected
By converting your plugin to HPOS-compatible today, you are assuring it continues to work with the eventual evolutionary changes in WooCommerce, sans urgent repairs later on.
At the moment, this is probably one of the biggest reasons developers are learning how to make a WooCommerce plugin HPOS compatible.
2. Significant Performance Improvements
HPOS was designed with one goal in mind: the elimination of the performance bottleneck caused by post-based order storage.
When your plugin gains HPOS compatibility:
- The orders related to queries will be executed more quickly.
- There will be a reduction in the time taken for the loading of the admin order screens.
- Timeouts will be shorter in large stores.
- There will be a marked decrease in the load on the database.
Because HPOS is properly indexed, WooCommerce is able to access order data faster—especially in stores that are processing thousands of orders every day.
3. Better Scalability for High-Volume Stores
On the point of scalability, HPOS indeed is a winner.
HPOS-friendly plugins are not troubled by:
- Huge amounts of orders
- Stores that operate on subscriptions
- B2B and large WooCommerce setups
- Sale across different platforms
Without HPOS compatibility, plugins often become the bottleneck as stores grow. Supporting HPOS ensures your plugin scales alongside your users’ businesses.
4. Improved Stability and Fewer Potential Bugs
Direct database accesses are fragile. Even the smallest updates for WooCommerce can break plugins already dependent on wp_posts or wp_postmeta.
HPOS-compatible coding forces developers to use better practices.
Developers are encouraged to:
- Use WooCommerce CRUD APIs
- Use a stable method of accessing data
- Make fewer assumptions about the database structure
Results:
- Fewer support tickets are submitted to your helpdesk.
- Fewer edge-case bugs are produced by your software.
- Easier debugging and future maintainability of your software.
5. Cleaner, Modern, and Maintainable Code
As developers learn how to make a WooCommerce plugin HPOS compatible, they are also learning how to create cleaner codebases.
The advantages HPOS provides are:
- Separation of concerns.
- Developers utilize API-driven methods to access data.
- Reduced use of custom SQL.
- Better long-term maintainability of the codebase.
This will be beneficial for all WooCommerce plugins going forward, but it also makes it much easier for developers who are on-boarded with your company to continue maintaining your software and making changes.
6. Higher Trust and Better User Experience
Store owners view HPOS Compatibility as a sign of great quality.
Users enjoy:
- Faster admin dashboards
- Order management reliability
- Fewer conflicts between plugins
- Long-term support
This means commercial WooCommerce plugin developers:
- Can receive better reviews.
- Receive more renewals than competitors.
- Benefit from lower churn rates than competitors.
7. Alignment With WooCommerce Best Practices
WooCommerce has recommended developers:
- Avoid directly querying the database.
- Use the WooCommerce CRUD APIs for orders.
- Support both legacy storage and the HPOS storage.
By building HPOS-compatible plugins, developers are in perfect alignment with the WooCommerce Developer Documentation and the WooCommerce guidelines for plugins.
How to Make WooCommerce Plugin HPOS Compatible

The guide’s main section, the developer’s most important resource, is here. This article is made immensely better by providing easier steps to follow, a logical structure, and by explaining the theory with practical examples and the best practices around them, while still keeping it in line with WooCommerce’s official recommendations.
If you want a plugin that will work in the present and in the future, do not deviate from these steps.
Step 1: Understand What Breaks When HPOS Is Enabled
Before coding, you must understand why plugins break under HPOS.
Patterns That Break Most Commonly
- Direct access to wp_posts or wp_postmeta.
- Custom SQL queries targeting order tables.
- Reliance on WordPress post hooks for orders.
- Hardcoded assumptions about order IDs and post types.
With HPOS, the guarantee that an order is a WordPress post is removed. Your plugin will break if it predicates on this.
This shift in thinking is the very basis of understanding how to make a WooCommerce plugin HPOS compatible.
Step 2: Make Your Plugin’s HPOS Compatibility Known
To prevent admin warnings, WooCommerce requires a clear-cut compatibility declaration.
Why This Step is Required
- Removal of “Incompatible with HPOS” notices.
- A notification to WooCommerce of adherence to standards.
- Future WooCommerce releases will make this necessary.
How to Implement
Insert the following code into your plugin’s main file:
add_action( 'before_woocommerce_init', function() {
if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility(
'custom_order_tables',
__FILE__,
true
);
}
} );
Key Points to Remember
- Only declare compatibility after thorough testing
- Do not put this in feature checks
- Use once per plugin
Step 3: Check if HPOS Is Active (It’s Safe)
Both legacy and HPOS storage must be supported by your plugin.
Correct Detection Method
use Automattic\WooCommerce\Utilities\OrderUtil;
if ( OrderUtil::custom_orders_table_usage_is_enabled() ) {
// HPOS enabled
} else {
// Legacy storage
}
Best Practices
- Whenever possible, avoid branching logic.
- Use WooCommerce APIs that work in both modes.
- Don’t inspect database tables directly.
Step 4: Replace Direct Database Access With CRUD APIs
This step is a must. It is non-negotiable.
Remove This Pattern
get_post_meta( $order_id, '_order_total', true );
Use WooCommerce CRUD Instead
Get Order Object
$order = wc_get_order( $order_id );
Read Meta
$total = $order->get_total();
Write Meta
$order->update_meta_data( '_custom_key', 'custom_value' ); $order->save();
The Importance of CRUD APIs
- They abstract away the way data is stored.
- They enable integration of HPOS systems & Legacy systems.
- They insulate your system from future schema changes.
Important Rule: Any time you are using get_post_meta() for orders, it indicates that you are not compatible with HPOS using the latest version of WordPress.
Step 5: Query Orders the HPOS-Safe Way
Do Not Use
WP_Query( [
'post_type' => 'shop_order'
] );
Use WC_Order_Query
$query = new WC_Order_Query( [
'limit' => 10,
'status' => 'completed',
'meta_query' => [
[
'key' => '_custom_key',
'value' => 'yes',
],
],
] );
$orders = $query->get_orders();
This method works even if HPOS is not enabled.
Step 6: Check Order Type Correctly
Legacy Method
get_post_type( $order_id );
HPOS-Compatible Method
$order = wc_get_order( $order_id );
if ( $order && 'shop_order' === $order->get_type() ) {
// Safe logic
}
This helps to ensure compatibility across all storage systems.
Step 7: Audit and Update Admin Order Hooks
HPOS offers new features on Admin screens, so there are likely older hooks that won’t trigger at all anymore.
Audit these areas
- The columns in the order list
- The available bulk actions
- The existing order filters
- Custom buttons on orders
Use HPOS-Safe Hooks
woocommerce_admin_order_data_after_order_detailswoocommerce_before_order_object_savewoocommerce_order_list_table_prepare_items
Step 8: Register Meta Boxes the Right Way
Incorrect Approach
add_meta_box( 'box', 'Title', 'callback', 'shop_order' );
Correct HPOS-Compatible Approach
add_action( 'add_meta_boxes', function() {
$screen = wc_get_page_screen_id( 'shop-order' );
add_meta_box(
'custom_box',
'Custom Data',
'callback',
$screen
);
} );
This works for:
- Legacy admin screens (i.e., older theme, order)
- HPOS admin screens (i.e., new admin interface for WooCommerce)
- Future WooCommerce updates (i.e., HPOS has been enabled in WooCommerce)
Step 9: Testing Your Plugin
To test your plugin, you should complete the following:
- Enable HPOS in WooCommerce settings
- Create orders using test orders
- Utilize the admin area for editing orders
- Use the functionality of the Plugin
- Disable HPOS and Repeat the Testing Process
Testing both options before declaring compatibility is recommended.
Final Thoughts: Make Your WooCommerce Plugin HPOS-Ready With Confidence
High Performance Order Storage changes a lot of things in WooCommerce. It’s not just some extra feature. It handles order data in a whole new way. WooCommerce is pushing this as the default soon. Plugin developers can’t really wait around anymore. If a plugin messes with order data at all, it has to work with HPOS now. That’s not optional.
Throughout this guide on how to make WooCommerce plugins HPOS compatible. It shows the steps pretty clearly. Like declaring that your plugin supports it. And figuring out if HPOS is being used.
Then we swapped out direct database stuff for the WooCommerce CRUD APIs. That seems important to avoid problems down the line. Each part helps make the code safer and ready for whatever comes next.
What You Should Take Away:
- HPOS switches from storing orders in posts to the better tables that scale up.
- Accessing
wp_postsandwp_postmetadirectly for orders isn’t dependable anymore. - CRUD APIs are key because they work whether it’s the old way or HPOS.
- You have to check admin hooks, meta boxes, and order screens carefully.
- Testing with HPOS on and off is a must before putting it out there.
Some people might skip that testing part. It feels kind of obvious but easy to overlook. Implementing this stuff means no more warnings about compatibility. Plugins end up faster and more stable for store owners. The architecture gets cleaner. Performance improves. And it’s easier to maintain over time.
If you’re building WooCommerce plugins for real, HPOS should just be in the regular process now. Start on it today. That way, the plugin stays reliable and fits with WooCommerce’s plans.
Frequently Asked Questions (FAQs)
Q1. What is HPOS in WooCommerce?
HPOS is used to store WooCommerce order data. HPOS stores the order data in custom tables that are optimized. HPOS puts the data in those custom tables of the default WordPress tables. HPOS makes the site run faster and lets the site handle orders.
Q2. Why should I make the WooCommerce plugin HPOS compatible?
Making your plugin HPOS-compatible makes your plugin HPOS work with the future updates of WooCommerce. Your plugin, HPOS-compatible, also runs faster. Your plugin is HPOS-compatible, also stops function problems in the stores that enable HPOS.
Q3. Will the plugin stop working if HPOS is enabled?
If your plugin relies on methods, like direct database queries or wp_postmeta, your plugin could break. I have seen plugins break in that way many times. Updating to HPOS practices makes the plugin work with the system. The update also prevents errors.
Q4. How can I test my plugin for HPOS compatibility?
I would first enable HPOS in the WooCommerce settings. Then I would place a test order. Finally, I would check that the plugin features run without any errors or slowdowns in HPOS and in the legacy mode.
Q5. Do I have to use HPOS for all WooCommerce plugins?
No, HPOS is optional for now, but WooCommerce plans to make it the default order storage method in future versions. It’s wise to update your plugin now to stay ahead of future changes.

Ekta Lamba
Ekta Lamba is a tech writer at DevDiggers focused on making WordPress and WooCommerce straightforward for non-developers. She covers plugin errors, platform updates, and WordPress basics, written so readers can follow along without a second tab open to translate the jargon.
Join thousands of readers getting smarter every week.

Leave a Reply