Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Programmatically Check if HPOS is Enabled in Your WooCommerce Site ?

WooCommerce’s High-Performance Order Storage (HPOS) is a smart way to efficiently store orders in the database.
Previously, WooCommerce stored orders in a structure that could slow down queries and make order lookups inefficient,  especially for stores handling a large volume of orders. HPOS solves this by introducing dedicated database tables specifically for orders. This separation makes order lookups and updates much faster, improving overall store performance.

While HPOS optimizes how current orders are stored, old and inactive orders can still accumulate and bloat your database over time. In such cases, tools like Flexi Archiver can help. It automatically archives old orders to the cloud, freeing up space and keeping your WooCommerce store fast and optimized.

By adding this snippet, you can visually confirm HPOS status right from your WordPress admin dashboard. 

Solution: Programmatically Check if HPOS is Enabled in Your WooCommerce Site

Typically, you would need to go to WooCommerce → Settings → Advanced → Features → High-Performance Order Storage to check if HPOS is enabled. But this simple snippet displays a WordPress admin notice that clearly tells you whether HPOS is enabled or not on your site.

add_action( 'admin_notices', function() {
    if ( class_exists( 'Automattic\WooCommerce\Utilities\OrderUtil' ) &&
         Automattic\WooCommerce\Utilities\OrderUtil::custom_orders_table_usage_is_enabled() ) {
        echo '<div class="notice notice-success"><p><strong>✅ HPOS is ENABLED on this site.</strong></p></div>';
    } else {
        echo '<div class="notice notice-error"><p><strong>❌ HPOS is NOT enabled on this site.</strong></p></div>';
    }
});

Output

If your site is using WooCommerce’s High-Performance Order Storage, the snippet displays a green success notice in your WordPress admin area saying: HPOS is ENABLED on this site.
This means your store is already using the new HPOS tables (wc_orders and related tables) for storing orders.

If your site is still using the legacy posts table (wp_posts and wp_postmeta) for order storage, the snippet will instead display an error notice in your WordPress admin area saying: HPOS is NOT enabled on this site.

WooCommerce’s High-Performance Order Storage (HPOS) is a game-changer for improving order management speed.

As your store evolves, you may also want to fine-tune how orders and their statuses are managed. You can also manage order statuses programmatically by following our post on deleting custom order statuses in WooCommerce. This helps keep your store’s order data clean and organized—especially important when HPOS is in use.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Leave a Reply

Your email address will not be published. Required fields are marked *

Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible.

Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

By using our site, you acknowledge that you have read and understood our Privacy Policy and Terms & Conditions.