How to Migrate a WooCommerce Multisite to a Single WordPress Store

Switching from a WordPress Multisite to a single installation is tricky, especially when it’s also a WooCommerce store. Here’s how to do it without error.
Share on facebook
Share on twitter
Share on email
Share on facebook
Share on twitter
Share on email
Migrate WooCommerce Multisite to a Single Site

Migrating a WordPress Multisite network to a single website is tricky business. It doesn’t get any easier when you also have WooCommerce installed.

While there are many great tutorials online that describe how to switch Multisite to a single site, there don’t seem to be any that include WooCommerce.

It’s even more difficult if you need to make a subsite into a standalone WordPress online store with a different domain name.

Not to worry!

Here’s how to move a WooCommerce Multisite subsite with two domains to a single WooCommerce site that has one domain name.

Before You Get Started

It’s crucial that you back up your entire Multisite installation before you get started with making the switch from a WooCommerce Multisite to a single installation. This includes all the WordPress files and database tables.

It’s also helpful to place your site into maintenance mode so your visitors don’t experience errors while you make the change. Your visitors won’t be able to use your site temporarily which helps prevent errors.

If something goes wrong along the way, you can restore your Multisite network from the backup and try again.

There are many maintenance mode plugins out there and WP Maintenance Mode is a popular option.

There are also many suitable backup plugins such as BlogVault, BackupBuddy, or Codeguard. Alternatively, your hosting provider may even provide daily automated backups. If you’re not sure if this is an option, contact your host.

Once that’s done and dusted, you’re ready to migrate your WooCommerce Multisite.

1. Download the Database

In a WooCommerce Multistore, certain tables are duplicated for each site in the network.

To migrate one site in the Multistore, you need to export the corresponding set of tables for that subsite.

For example, if the subsite ID is 2, you need to copy the tables that begin with “wp_2_”. Additionally, you also need to export the user tables.

Export the subsite tables that you want to migrate to a single site.

To export the tables, log into phpMyAdmin and click on your site’s database in the menu on the left. Then click Export.

Keep all the tables checked including your subsite’s ID. In the above example, it’s the tables with “_2_” in the names.

Unselect all other tables except for the wp_users and wp_usermeta tables.

Export the subsite tables that you want to migrate to a single site
Keep the users and usermeta tables checked.

All the other settings can remain the same. Then, scroll down to the bottom of the page and click Go.

Your database tables will be exported to your computer. This may take a while, depending on the size of your tables.

2. Editing the Database’s Table Names

Next, you need to rename the subsite database tables to remove the ID number and the adjacent underscore. In keeping with the above example, this would mean removing “2_”.

Open the downloaded SQL file in a text editor like Visual Studio Code and quickly edit the table names with a search and replace for the ID number and following underscore.

The table names should be updated without any of the data within the tables being affected.

Save the file and close the editor.

3. Importing the Updated Database 

Now, it’s time to create a new database where you can import your updated tables.

In cPanel or your hosting provider’s control panel, create a new database. Then in phpMyAdmin, select the new table and click Import.

It may be important to note that if you’re using a subdomain or subfolder Multisite structure, you also need to change the URL in the “siteurl” and “home” database rows in the wp_options table. Update them to the single site’s URL you want to use.

4. Removing WooCommerce Multisite

For the migration to work, you need to disable Multisite and update the database credentials in your wp-config.php file. The database details need to be modified to reflect the new database you created in the last step.

In the root of your original website, locate the wp-config.php file. Open it in a text editor.

Update the database table to the new credentials of the database you created such as in the example below:

define('DB_NAME', 'new_table_name');
define('DB_USER', 'new_user_name');
define('DB_PASSWORD', 'new_user_password');

Further down in the file, find the following that’s above the “happy blogging” line:

define( 'WP_ALLOW_MULTISITE', true );
define('MULTISITE', true);
define('SUBDOMAIN_INSTALL', false);
define('DOMAIN_CURRENT_SITE', 'my_site_com');
define('PATH_CURRENT_SITE', '/');
define('SITE_ID_CURRENT_SITE', 1);
define('BLOG_ID_CURRENT_SITE', 1);

Replace it with this code:

define( 'WP_ALLOW_MULTISITE', false );

Once that’s done, save the file.

5. Editing Your .htaccess File

Now, in the root of your original site, find the .htaccess file. Open it in a text editor.

Find the following code and delete it:

# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
# END WordPress

Add the following code to replace it:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

Save and close the file once you have replaced the code.

6. Copying Images from the Multisite to the Single Site

Next up, you need to copy the /wp-content/uploads/ folder for the entire WordPress Multisite. You’ll also need the specific uploads folder for the subsite you want to migrate.

The subsite’s uploads folder can be found in the /wp-content/uploads/sites/#/ directory where “#” is the ID number of the subsite to be migrated.

Save a copy as a backup. Then using an FTP client like FileZilla, copy the /wp-content/uploads/sites/#/uploads/ folder to /wp-content/uploads/. This will replace all of the contents that were originally uploaded there. It will also delete the /wp-content/uploads/sites/ folder.

7. Replace Image Links in Your Database

You should be able to log into your new single installation of WordPress. At this point, the Multisite network will be gone.

Log in and install the Search and Replace plugin so you can update image links. They’ll be broken because you switched the folders to a new location in the previous step.

Go ahead and activate the plugin. Then, go to Tools > Search & Replace. Click on the Search & Replace tab.

In the Search for field, enter /uploads/sites/#/. But, update “#” to your old subsite’s site ID before you migrated it.

In the Replace with field, enter /uploads/ and check the Dry Run box. This is optional, but recommended. It helps you ensure the process will be done without error.

Search for and update broken image links.

Then, click the Do Search & Replace button. When you’re confident that there aren’t errors, uncheck the Dry Run box.

Select Save changes to database, then click the Do Search & Replace button.

The broken images on your site should work now. If you find there are still broken media content on your site, try to add your old domain in the Search for field. In the Replace with field, add the URL to your new, single site.

8. Saving the Permalinks

The final step is to save the permalinks structure. It’s an essential step that will ensure all the links on your new site work properly.

Go to Settings > Permalinks and click Save Changes.

Helpful Tips for Migrating WordPress Multisite to a Single Site

After completing the steps above to switch your WooCommerce Multistore network into a single installation, you may find some issues arise. This could be due to multiple factors.

Here are some of these issues you should check for after making the switch:

  • Your code should be searched for places where your old network’s URL is hardcoded. If you find any, replace them with the new URL.
  • It’s recommended you delete any plugins that you no longer need since your site isn’t a Multisite network anymore.

There are a couple of other tasks which you may need to complete:

  • Any tracking codes from your Multisite network should be copied to your new, single installation.
  • To improve SEO, the old URL from your Multisite network should be 301 redirected to the new URL for your single installation.

Wrapping Up

Switching from a WooCommerce Multistore setup to a single installation of WordPress is certainly a tricky task. But, if you follow the steps outlined above, you can successfully  migrate your site.

Depending on the complexity of your site, a lot of errors could come up. If you’re unsure about any of the steps to switch over your site, it’s best to get a verified WooCommerce expert developers to do it for you.

Not only will your site be switched error-free, but you’ll also be able to significantly reduce the downtime of your website. You’ll also be able to rest easy knowing your site’s fully backed up so you won’t lose any important data.

Why do you want to switch from WooCommerce Multisite to a single installation? Were you able to successfully make the switch? Did you run into any errors you can’t seem to resolve? Feel free to share your experience in the comments below.

Table of Contents
Our Sponsors
Our sponsors

Leave a Reply

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

Stay up-to-date with the Mayor
Sign up to receive one weekly email about our latest reviews, tutorials, giveaways and more.