Skip to content Skip to sidebar Skip to footer

Woocommerce Continue to Payment Top and Below Form or Hover

WooCommerce Subscriptions & Subscriptions by WooCommerce Payments can handle staging sites and migrations. Many hosts provide an easy way to create a clone of your website for testing changes. This is called a staging site .

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

Duplicate Site Warning ↑ Back to top

You will know when the site is in staging mode because Subscriptions will display a warning in the administration area of your site. This notice also shows which URL Subscriptions considers to be the live site.

Staging Site Notice

Subscriptions will also display a staging badge next to the WooCommerce > Subscriptions menu item when a store is in Staging Mode.

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 .

It is possible to enable automatic payments and to send subscription-relation emails on a staging site.

Please note: it is only emails sent by Subscriptions that will be blocked by Subscriptions in staging mode, any emails sent or managed by WordPress, WooCommerce or another plugin may still be sent from your staging site. To block all emails from your site, install a plugin like Disable Emails.

What is considered a Staging Site?

Subscriptions & Subscriptions by WooCommerce Payments will keep a record of the URL of the site where it is first activated. It considers this to be thelive site and will run in live mode. If the site's URL then changes, it considers the new site to be astaging 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 live site, we recommendfirst activating it on the live site and then creating the staging site from that site's database.

Developer Note: WooCommerce Subscriptions stores an obscured 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 it has changed.

Check if Staging Mode is Enabled

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 mode, you can:

  1. Go To WooCommerce
  2. Check the Subscriptions menu item. If a red area is shown with the word Staging, the site is inStaging Mode. If nothing is displayed except "Subscriptions", the site is inLive Mode.

Whether the store is running in Staging or Live mode is also displayed on the Status screen. To check it there, you can:

  1. Go To WooCommerce > Status
  2. Scroll down toSubscriptions Mode
  3. Check the value. If a red cross is shown with the word Staging, the site is inStaging Mode. If a tick mark is shown with the word Live, the site is inLive Mode.

Below this section will be a row labeledSubscriptions Live URL. This shows the URL that Subscriptions considers to be the live site.

Enabling Automatic Payments on a Staging Site ↑ Back to top

To switch your site fromStaging Mode toLive Mode:

  1. Make sure you're within the WordPress admin area, e.g. example.com/wp-admin/
  2. Select theEnable Automatic Payments button displayed in the staging site notice.

If at first you chose the Quit Nagging Me option, or perhaps this notice is missing, and you want to enable automatic payments on the staging site, you can do the following:

  1. Go to example.com/wp-admin/?wcs_display_staging_notice=true while logged in as an administrator, replacing example.com with your site's URL.

If this doesn't help you still have options, but this involves editing and accessing the database directly. We'd recommend backing up your site and database before using this method.

  1. Access your database via PhpMyAdmin if your host provides it (or install a plugin like WP phpMyAdmin).
  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 "false."
  4. Save the changes to the option value.

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

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:

  • Change the site URL for it, this will switch that site into staging mode; or
  • Disable Action Scheduler's default queue runner to ensure Subscriptions doesn't trigger renewal events.

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:

  • Change the site URL for it, this will switch that site into staging mode. In some cases, wc_subscriptions_siteurl value might need to be updated as well, the option can be found under https://YOUR-DOMAIN.com/wp-admin/options.php (replace YOUR-DOMAIN.com with your own domain URL); or
  • Disable Action Scheduler's default queue runner to ensure Subscriptions doesn't trigger renewal events.

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).

Disabling All Scheduled Events ↑ Back to top

By default, scheduled renewals and other scheduled events, like expiration, will still be triggered when Subscriptions is in staging mode. No payments will be attempted, or emails sent, for these events, but the event will still be initiated as it would be on the live site.

If you wish to stop these events being triggered, install and activate the free Action Scheduler – Disable Default Runner plugin.

This plugin disables all events in the scheduling library WooCommerce Subscriptions uses. This library is also used by other extensions, like WooCommerce Memberships, so will also disable any scheduled events for those plugins.

The Action Scheduler – Disable Default Runner plugin does not rely on the site URL check. Once active, it will block scheduled events. As a result, it can also be used on a live site to temporarily disable renewals payments and other scheduled events.

Enabling Subscriptions Emails on a Staging Site ↑ Back to top

If you would like to enable subscription-related emails on a staging site, you can define the WCS_FORCE_EMAIL constant.

In order to enable this constant:

  1. Go to your site's wp-config.php file
  2. Above the line that says /* That's all, stop editing! Happy blogging. */, add:
    if ( ! defined( 'WCS_FORCE_EMAIL' )) {
    define( 'WCS_FORCE_EMAIL', true );
    }
  3. Save file

FAQ ↑ Back to top

Why are the subscriptions all displayed as manual renewal? ↑ Back to top

In order to prevent collecting duplicate payments from your customers on a staging site, all subscriptions get switched into manual renewal mode. When this occurs, all the subscriptions listed in the WooCommerce > Subscriptions admin table will be Manual Renewal. To view the "live" payment method, you can hover over the ? to display the note.

Staging site subscription's payment method note

Similarly, if you edit a subscription while the site is in staging mode, the payment method displayed in the Billing details is also set to Manual Renewal. You can edit the payment method, those changes will take effect if/when the site is switched into live mode.

Why are renewal payments not processing on the live site? ↑ Back to top

When a renewal is processed in Staging mode, the following note will be added to its order notes:

Payment processing skipped – renewal order created on staging site under staging site lock. Live site is at https://example.com/

On occasion, these notes may appear on renewal orders created on the live site. This means the live site is accessible via more than one URL. For example, the site may be accessible via both:

  • https://www.example.com
  • https://example.com

To process renewals correctly, Subscriptions requires your WordPress site to be accessible via only one URL.

To ensure your site is accessible via only one the URL, you can use the WordPress Site URL constants in your wp-config.php file to set the URL for the site. For example:

define( 'WP_SITEURL', 'https://example.com' ); define( 'WP_HOME', 'https://example.com' );

You should also make sure your web server software, like Apache, is configured to redirect any requests to other URLs to the canonical URL. WordPress has a guide on setting up.htaccess file correctly. If you need additional help, please contact your web host.

Serving your site under a single URL is good practice as it has other benefits, most notably for SEO. As Moz explains:

Duplicate content is content that appears on the Internet in more than one place. That "one place" is defined as a location with a unique website address (URL)

While not technically a penalty, duplicate content can still sometimes impact search engine rankings. When there are multiple pieces of, as Google calls it, "appreciably similar" content in more than one location on the Internet, it can be difficult for search engines to decide which version is more relevant to a given search query.

Why are emails still being sent on my staging site? ↑ Back to top

WooCommerce Subscriptions will only block emails sent by it when in staging mode. Emails sent or managed by WordPress, WooCommerce or another plugin may still be sent from your staging site.

To block all emails from your site, install a plugin like Disable Emails.

patelboweache94.blogspot.com

Source: https://woocommerce.com/document/subscriptions-handles-staging-sites/

Post a Comment for "Woocommerce Continue to Payment Top and Below Form or Hover"