Switching to HPOS doesn’t require closing the store. WooCommerce can copy orders to the new tables while the store is running, and the switch itself is a setting. What makes it safe is the order you do things in: plugins first, then sync, then a test on a copy, and only then the live store.
Here’s the process step by step. If you first want to know what HPOS is and whether it’s worth switching, read our guide to WooCommerce HPOS.
Before you start
- A backup and a copy: Take a full database backup, and make a copy of the store with the same plugins that you can test on.
- An up-to-date WooCommerce: Update WooCommerce and the plugins that touch orders before you begin, so you’re not testing versions you’ll be moving away from anyway.
- A queue that runs: Orders are copied through WooCommerce’s scheduled actions queue. Check under WooCommerce → Status → Scheduled Actions for many pending or failed actions, and clean up first. Why the queue should run from the server is covered in the section on background jobs.
- A quiet time: Don’t plan the switch right before a big sale. If Black Friday is close, see our Black Friday checklist, and switch afterward.
Check plugins and custom code
Plugins declare whether they’re compatible with HPOS. WooCommerce shows it on the plugins screen and under WooCommerce → Settings → Advanced → Features, and as long as an active plugin is marked incompatible, you can’t switch. Look for a newer version, ask the developer, or find an alternative.
The harder part is what doesn’t declare anything: custom code in the theme, small plugins a previous developer wrote, and older plugins that haven’t been updated in a while. That’s code that fetches orders with get_post_meta(), queries posts of the type shop_order, or runs SQL directly against wp_posts and wp_postmeta. It works as long as the orders are there, and quietly stops working when they aren’t. Have it reviewed and moved to WooCommerce’s own functions before you switch.
Step 1: Turn on sync
Under WooCommerce → Settings → Advanced → Features, turn on compatibility mode while the store still uses the old storage. WooCommerce then starts copying existing orders to the HPOS tables in the background, in batches, and writes new orders to both. The same page shows how many orders are left.
If the store has many orders, that can take a long time through the queue. If you or your hosting provider have WP-CLI access on the server, the sync can be run from there instead. WooCommerce’s documentation on the HPOS CLI tools describes the commands:
| Command | What it does |
|---|---|
wp wc hpos status | Shows whether HPOS and compatibility mode are on, and whether sync is pending |
wp wc hpos count_unmigrated | Counts the orders not yet copied |
wp wc hpos sync | Copies orders from the storage the store uses now to the other one |
wp wc hpos verify_data | Compares the orders in the two storages and shows differences |
For bigger stores, WooCommerce also has a guide for large stores. Don’t move on until every order is synced.
Step 2: Switch on the copy, and test the whole flow
Do the same on the copy, then switch order storage to HPOS with sync still on. Then go through everything that touches an order:
- Place an order with every payment method and every shipping method.
- Open, edit and search for orders in the admin, old orders included.
- Check order emails, invoices and shipping labels.
- Check that orders reach accounting, inventory and any other system that receives them.
- Make a refund, and check subscriptions and reports if the store uses them.
If something doesn’t work, switch back on the copy, fix it, and try again. That’s exactly what the copy is for.
Step 3: Switch on the live store
Once the copy works and every order on the live store is synced, switch order storage to HPOS on the same page. The store doesn’t need to close: customers can keep buying, because new orders are written to both places. Still pick a quiet time, so as few orders as possible come in while you check.
Place a test order right after, and follow it all the way: admin, emails, payment and integrations. If you have WP-CLI, run wp wc hpos verify_data to see that the two storages match.
Step 4: Leave sync running, then turn it off
Leave compatibility mode on for a while after the switch, long enough for everything that happens to orders in a normal period to have run: refunds, subscription renewals, exports to accounting. That way you can switch back if something comes up.
Once everything works, turn sync off. WooCommerce then writes only to the HPOS tables, and you get the full benefit. The old order data stays in wp_posts and wp_postmeta. Leave it there until you’re completely sure, and take a backup before anyone cleans it up.
If something goes wrong
If sync is still on, just switch order storage back to WordPress posts, and the store carries on with the old tables and every order. If you’ve already turned sync off, the old tables haven’t received the latest orders. Then sync has to be turned on again and finish before you switch back.
Frequently asked questions
Does the store need maintenance mode during the switch?
No, not if every order is synced before you switch. The sync runs while the store is open, and the switch itself is a setting.
How long does the sync take?
It depends on the number of orders, how much data plugins have stored on them, and the server. Follow the count of remaining orders under Features, or use wp wc hpos count_unmigrated, and plan from that.
Want help?
The time-consuming part of an HPOS switch is finding the plugins and code that go straight to the old tables. If you’d like us to review the store and handle the switch, read about optimizing your WooCommerce store. We take a free look at your store first and tell you what it will take.