How Does Subscriptions Handle Staging Sites and Migrations?

Some hosts, like SiteGround, provide an easy way to create a clone your website for testing changes, called a staging site.

To prevent duplicate payments from a clone of your site, Subscriptions will disable automatic payments and subscription related emails whenever the current site’s URL differs to the URL of the site where Subscriptions was first activated.

You will know when this is happening because Subscriptions will display a warning in the administration area of your site.

subscriptions-duplciate-site-warning

Duplicate Site Warning ↑ Back to top

You can still test subscription renewals on a test site, but Subscriptions will use the manual renewal process and will not send any subscription related emails.

If want to enable automatic payments on the new site, either because you have changed the test site’s payment gateway to use a sandbox mode and updated all customer emails for the staging site, or because the new site is a permanent migration of the old site, then click the Enable automatic payments button displayed in the administration notice.

Please note: it is only Subscription related emails will be blocked by Subscriptions, specifically, the emails mentioned in the Emails section of the Subscriptions’ Store Manager guide, any emails sent or managed by WordPress, WooCommerce or another plugin will still be sent from your staging site. If you wish to block all emails from your site, you need to use a plugin like Stop Emails or Disable Emails (neither of these plugins are endorsed by WooCommerce.com, they are simply free options that offer to block emails).

What does Subscriptions consider a Staging Site? ↑ Back to top

Subscriptions will keep a record of the URL of the site where it is first activated. It considers this to be the live site and will run in live mode. If the site’s URL then changes, it considers the new site to be a staging site and it will run in staging mode.

This means if you first activate Subscriptions on a staging site, Subscriptions will run in live mode on the staging site because it considers this site to actually be your live site.

Because of this, if you want to test Subscriptions on a staging site before running it on your life site, we recommend first activating it on the live site and then creating the staging site from that site’s database.

Developer Note: Subscriptions stores a clone of WordPress’ siteurl value in an option with the name wc_subscriptions_siteurl. It compares this value with the siteurl value to see if the value has changed.

Check if Staging Mode is Active ↑ Back to top

If you are unsure whether you or another administrator on the site has dismissed the notice and want to check if the store is running in Staging or Live mode, you can:

  1. Go To WooComerce > System Status
  2. Scroll down to Subscriptions Mode
  3. Check the value. If a red cross is shown with the word Staging, the site is in Staging Mode. If a tick mark is shown with the word Live, the site is in Live Mode.

system-status-for-a-site-in-staging-mode

Enabling automatic payments on a staging site ↑ Back to top

To switch your site from Staging Mode to Live Mode:

  1. Go to any admin page on your site, e.g. visit example.com/wp-admin/
  2. Click the Enable Automatic Payments button displayed in the staging site notice.

If you chose the Quit Nagging Me option, but then later find you want to enable automatic payments on the test site, you can:

  1. Access your database via PhpMyAdmin if your host provides it (or install a plugin like ARI Adminer if your host does not provide phpMyAdmin access)
  2. Search the wp_options table for an option with the option_name of 'wcs_ignore_duplicate_siteurl_notice'
  3. Change the option value of the 'wcs_ignore_duplicate_siteurl_notice' option to anything other than its current value, “false” would be a good choice.
  4. Save the changes to the option value

The staging site notice should reappear and you can choose to Enable automatic payments.

Database Migration ↑ Back to top

When migrating your site’s database from one server to another server, there are additional considerations.

If you have migrated your site’s database and the domain name has not changed, the staging mode will not be triggered on the new site. This means renewal payments will be processed in live mode. If you want to make sure payments are not processed, even temporarily, you need to:

Decommission the Old Site ↑ Back to top

To avoid any issues with duplicate payments or emails, you should decommission the old site as soon as possible.

However, if you need to continue to allow the old site to run after migrating the database to a different server, you must also:

Without completing one of these steps, your old site will continue to process real recurring payments.

We also suggest you block all emails from your duplicate site to prevent customers receiving any emails from this old site. To do this, you can use a plugin like Disable Emails (this plugin is not officially endorsed by WooCommerce.com).

WooCommerce - the most customizable eCommerce platform for building your online business.

Back to the top