How to move a WooCommerce Subscriptions site to a new domain and how it uses staging site mode

Last Updated on: 18th October 2017, 04:50 pm

What happens when you move a WooCommerce with active WooCommerce Subscriptions?

WooCommerce Subscriptions knows when it was moved to a new domain and immediately stops all recurring payments on the newly moved site until manually reactivation. This way no double payments are triggered automatically.

Checklist for moving your WooCommerce Subscriptions site:

Tread carefully! A WooCommerce store with active WooCommerce Subscriptions is a complex structure. Expect trouble and always have a contingency plan that allows you to undo all of your actions so you can rollback when you hit a dead end. Do not undertake to move your site without thorough preparation.

How WooCommerce Subscriptions knows it is a staging site

Upon activation of the plugin WooCommerce Subscriptions immediately copies the siteurl value in wc_subscriptions_siteurl. When you move your WordPress site, the value in siteurl must be changed. If there is a mismatch in both values, WooCommerce Subscriptions knows it has been moved, thus triggering its staging mode and setting all payments to manual.

Upon your first arrival in the dashboard of your staging site you then see this:

subscriptions-duplciate-site-warning

Mind you the payments are set to manual only via the database, it does not alter these settings:

Screen Shot 2016-04-28 at 11.56.54

The settings are located at: /wp-admin/admin.php?page=wc-settings&tab=subscription

How you know WooCommerce Subscriptions in in staging mode

You can also check your WooCommerce System status under /wp-admin/admin.php?page=wc-status
Find the Subscriptions Mode value there. If this is what you see, Subscriptions Mode: x Staging, then WooCommerce Subscriptions is in staging mode.

 

UsioiTyLUXweb

No WooCommerce Subscriptions payments will be processed by this staging site now.

How to stop WooCommerce Subscriptions notification emails

Keep in mind though that your staging system still is sending out all WooCommerce notification emails. If you want this to stop as well, you will need to use a plugin such as:

Do not forget to revert this after you have deployed back to live.

Payments on live site not processing after re-enabling payments

If you have deployed your WooCommerce Subscriptions staging site back to live and have trouble with payment processing, you should check the following values:

  • siteurl
  • wc_subscription_siteurl
  • wcs_ignore_duplicate_siteurl_notice

All three values must match, in order for your payments to process correctly again on your live site. If not you need to edit them manually, here is how.

  • Copy the url from siteurl: lets say https://www.conschneider.de
  • check the value stored in wc_subscription_siteurl
  • if the wc_subscription_siteurl is different to siteurl we need to change it. The correct value for this column is the siteurl
    but with __ inserted into the middle of the string (this is so that stuff doesn’t break on WPengine 😉 ).
    Set the value to http://www.__conschneider.de
  • check the value stored in wcs_ignore_duplicate_siteurl_notice is also set to the same value as wc_subscriptions_siteurl. If not correct it the same way.

Be careful! Tampering with your database can render your site useless. Always make a full backup of your database (and files) beforehand!

Further read How does Subscriptions handle staging sites? on WooCommerce.com.

16 responses

  1. I have multisite/multi-lingual in wpengine. i.e. In Enlgish, In Italian.
    we have different URL for the both version. i.e. .COM & .it
    I have followed the steps you have mentioned still it’s displaying :STAGING MODE in “.COM” version.

    1. Con Schneider Avatar
      Con Schneider

      Hello Kumar,

      How is the multi-language setup?

      1. As it was a new installation. we installed directly on a live website. wooCommerce subscription is suggesting to activate the plugin on the live site because it keeps the track where it’s activated for the first. you know what’s crazy. I got a similar issue with one my website. after 2.5 years, I came across to your website through google. I found myself in the comment section. thank you very much con..

        1. Con Schneider Avatar
          Con Schneider

          > I got a similar issue with one my website. after 2.5 years, I came across to your website through google. I found myself in the comment section. thank you very much con..

          You are welcome.

  2. I did all that configuration, and my website still in staging mode. Do you know if is there something could be messing? I’m using a new domain name.

    – siteurl
    – wc_subscription_siteurl
    – wcs_ignore_duplicate_siteurl_notice
    Are all same here.

    If i change wc_ignore_duplicate_siteurl_notice to any value and try to enable automatic payments, nothing happens and warning still be appearing.

    1. Con Schneider Avatar
      Con Schneider

      Hi there,

      Looks like you have all the basis covered here. Other than the values named here which are the ones you recounted, I do not know of any you could check in addition. If all values check out, if all in your `wp-config.php`checks out, I would probably restart and move back to square one and then take it from there.

  3. Hi Con,

    I’m in the same process and actually migrating to WP Engine as well. I just asked their chat support about the need to add the underscore in the site name in the wc_subscription_siteurl field, and weren’t sure about it.

    As for us, our site hosted at the apex level, so there is no www prefixing. Would the correct format be?

    https://_domain.com

    Curious how not adding the underscore would potentially cause a problem with WP Engine.

    Thanks for writing this article and your time!

    1. Con Schneider Avatar
      Con Schneider

      Hi Eric,

      Thank you for the comment.

      In your case the correct format should still be: http://_[wc_subscriptions_siteurl]_domain.com. Tread with care and do take a database backup beforehand. This information should still be valid, but it is dated as well.

      As to why my SQL is not that refined, but I assume the underscores _ escape the brackets [] preventing an SQL execution.

      1. yes, it’s working. I just applied to one of my website on wpengine.

        1. Con Schneider Avatar
          Con Schneider

          Thanks your for you confirming and leaving the comment.

  4. I have subscriptions setup on a multisite environment and the “staging site” is actually the live site, however, I am getting the staging error on the new site. To make matters more complex, I have 301/404 redirection setup so I can’t go into my old site and “disable” subscriptions there.

    Is it enough to go to my network setup > sites > deactivate the old site?

    Any other suggestions? Thank you.

    1. Con Schneider Avatar
      Con Schneider

      Hi Ed,

      > Is it enough to go to my network setup > sites > deactivate the old site?

      That depends on why the error is showing. Per default WooCommerce Subscriptions uses the URL to determine it’s status, so deactivating the old site will not help. You need to update the old URL in your new live site so that WooCommerce Subscriptions does not believe it is in staging mode anymore.

  5. Vikas Bendha Avatar
    Vikas Bendha

    Hello Con,

    First of all, thank you so much for this detailed explanation.

    I am also going to move one existing woo-commerce website.

    So I have 2 websites right now.
    One has woocommerce with simple and subscription product data with all users.
    Another one has all the course content data which can be accessed after purchasing the course subscription from the first website.

    Now I want to use only one domain which will be the second one and for that I wan to move all of my customers, Orders, subscriptions and products to the second website.

    So I am afraid that how can I move all those woocommerce content from one to another without sending any unexpected emails nad without making any double charge while exporting subscriptions and orders.

    I think I have explained my situation properly here, so can you please help to give some proper guidelines on this that how can I start my whole process?

    If there is any plugin or anything else that you can suggest please do.

    Thanks a lot in advance.

    1. Con Schneider Avatar
      Con Schneider

      Hi Vikas,

      1) I would test the migration so you know the steps. And know what works.
      2) Shutdown live site for a few hours. Block all mails via: https://wordpress.org/plugins/stop-emails/
      3) Disable all payment gateways. Set WooCommerce Subscriptions into staging mode.
      4) Transfer data.
      5) Test, test, test.
      6) Enable live site again.

      These are just figments. Don’t rely on them, no warranty included ;).

  6. How do I disable the staging mode?

    1. Con Schneider Avatar
      Con Schneider

      Hi there,

      I think you can use this filter: add_filter( 'woocommerce_subscriptions_is_duplicate_site', '__return_false' );.

Leave a Reply

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

Con Schneider