Skip WooCommerce Orders and Products

Skip WooCommerce Orders and Products

Whenever you use WP Staging Pro to push changes from the staging site to the live site you need to make sure that WooCommerce Orders, WordPress users, and WooCommerce products on the live site are not affected in any way.

You also need to make sure if you make changes to the staging site and push the staging site to live, any orders, transactions, and users that were added in the interim will remain untouched.

So what is the best way to prevent those data from being overwritten during the pushing process?

First of all, we need to understand where WooCommerce and WordPress store transactional orders, products data, user data like customer addresses and all other data like posts and pages:

  • Orders and products are stored in table wp_posts and wp_postmeta separated by the custom post type ‘orders’
  • WordPress itself also stores all its data like pages, posts and even menu entries and everything else in these tables as well.
  • Users are stored in wp_users and wp_usermeta

There are also a bunch of other WooCommerce custom tables that store things like tax rates, order items, and general WooCommerce settings.

Each table name will be prefixed with a certain table prefix e.g. wpstg1_

The WooCommerce table names will be prefixed with the same table prefix but they also begin with _woocommerce like wpstg1_woocommerce_

The number in the prefix is the number of your staging site. So if you have multiple staging sites that number will be counted up like wpstg1_, wpstg2_ and so on.

If you want to migrate certain data from your staging site to the production site without affecting any of the transactional data you have three options:

A) Export orders and transactional data from the live site and import them into the staging site before migrating the staging site to live.
This allows you to copy the entire staging site.

B) Exclude relevant tables before you using the WP Staging push process. If you go that route you can not migrate the entire staging site including all of its data!
Depending on the excluded tables (e.g. _posts, _postmeta) this can lead to missing images and even layout elements on your production website if you use a visual editor like WPBakery (formerly known as the visual composer)

C) Exclude all database tables except the table _options and select only the plugins and themes folder you like to push to the staging site. Going this route way ensures that you never overwrite or lose data on the production site which has been generated after creating the staging site. Most of the plugins also store their plugin settings in the table _options. So this will also migrate the plugin settings to the live site as well.
Note: Any other missing data which is included in the tables _posts and _postmeta table needs to be created again on the live site by yourself manually.

Note: Option A and C are the recommended and more reliable ones!


To skip WooCommerce orders you need to exclude the tables below before you push the staging site to the production site:

  • wpstg1_posts
  • wpstg1_postmeta
  • wpstg1_users
  • wpstg1_usermeta
    All tables beginning with:
  • wpstg1_woocommerce_

The huge drawback is that this also excludes posts and articles and any other data that is stored in the tables _posts and _postmeta on our WordPress site. For instance, WordPress stores menu entries and all other custom post type data in these tables as well.

Export & Import WooCommerce Orders

So the better option is to export first your orders and product data with a separate export/import plugin from the production site and then to import them into the staging site before you do the push.

There are several plugins to do that job.
One of them is the one by WebToffee

(If you know another reliable import/export plugin please let us know)

Keep in mind that exporting and importing orders could possibly change the order id of new orders due to the reason that the WooCommerce order id is the same as the post id which is a unique number in WordPress.

So if the post id on your staging site is already used, the imported order gets a new id which results in a new order id.

For most store owners this might not be an issue but if you need to keep the order id you’ll need to use another plugin which adds a new database entry that stores the order id in a separate field that allows you to have that order id separated from the post id.

Before you push the staging site make sure to set your website into maintenance mode or to disable the shop system to make sure that no orders come in while you push data from the staging site to live.

Read also this ongoing in-depth and technical article about migrating WooCommerce orders from one site to another:

Before you export and import any orders from your live site to live it’s strongly recommended to create another staging site to test this whole process before you do the import and export on the real staging website!


See also: WooCommerce database table reference

Keywords: WP Staging + WooCommerce, WP Staging Exclude WooCommerce Orders, Exclude WooCommerce Products