Print

Skip WooCommerce Orders and Products

Skip WooCommerce Orders and Products

Whenever you use WP Staging Pro to push changes to 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 that if you make changes to the staging site and then push the changes, 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 are storing transactional orders,  products data, user data like customer address 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 and posts in the same tables.
  • Users are stored in wp_users and wp_usermeta

There are also a bunch of other WooCommerce custom tables which 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 push your staging site to the live one without affecting any of the transactional data on the live site you have two options:

A) Exclude relevant tables before you using the WP Staging push process.

B) Export orders and transactional data from the live site and import them into the staging site before migrating the staging site to live.

Note: Option B is the better and saver one!

 

To just skip WooCommerce orders you need to exclude the tables below.

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

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

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

Keep in mind that this will probably change the order id of most of your orders due to the reason that the WooCommerce order id is the same as the post id which is a unique number in WordPress.

If you like to keep the order id you need to install a separate plugin which install’s a new database entry which stores the order id in a separate field that allows you to have that order id separated.

Before you push the staging site make sure to set your website into maintenance mode or to disable the shopping 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:

Moving WooCommerce Orders Between Sites

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