How to Exclude WooCommerce Orders from Being Copied to the Live Site with “HPOS”

Recently WooCommerce introduced “High-Performance Order Storage” [HPOS] for WooCommerce orders as a beta feature, which you can activate to save WooCommerce orders data into separate database tables with the following names:

  • _wc_orders
  • _wc_orders_meta
  • _wc_order_addresses
  • _wc_order_operational_data

This guide explains how you can make use of this feature to prevent orders in the staging site from replacing orders on the live site whenever you push a staging site to the live site. To do that, follow these steps:

Before you enable HPOS on the primary staging site, it’s strongly recommended creating another staging site to test the whole process before you push the primary staging website replacing the live site! You can use WP Staging to create a staging site with one click.

Enable HPOS on Both the Live and Staging site:

Note: HPOS is heavily developed and still work in progress. You find a more detailed instruction on the official WooCommerce HPOS article.

Go to (WooCommerce > Settings > Advanced > Features) and check the “Enable the high performance order storage feature” box as in this screenshot on both the staging and live sites.

Enable Woocommerce HPOS High-Performance Order Storage custom order tables.

Go to (WooCommerce > Settings > Advanced > Custom data stores) and check the “Keep the posts table and the orders tables synchronized” box (you have to enable this for the first time during the setup, then you should be able to turn it off if you want) and click on “Save Changes” as in this screenshot:

Activate the option keep the posts table and the orders tables syncronized

After this step WooCommerce will start to sync orders from the regular _posts table to the new _wc_orders table, wait a few minutes then refresh the page and when the synchronization is done, you will see this:

Activate the option Use the WooCommerce orders tables

Now you need to choose “Use the WooCommerce orders tables” option as in the screenshot above, and you can enable/disable “Keep the posts table and the orders tables synchronized” as mentioned.

Again, it’s a must to do these steps on both the live and staging sites.

Exclude WooCommerce Orders Tables During The Pushing Process

Now when it comes to pushing a staging site to the live site, you can exclude these tables:

Unselect the woocommerce order tables

And your live site’s WooCommerce orders will remain the same after the push and not replaced with the staging site’s ones.

Updated on July 26, 2023