Skip to content

Disable Staging Mode for specific subscriptions, as defined in a WCS_UPSTAGED_SUBSCRIPTION_IDS constant.

License

Notifications You must be signed in to change notification settings

woocommerce/woocommerce-subscriptions-upstage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

IMPORTANT: This code is made available in the hope that it will be useful, but without any warranty. See the GNU General Public License included with the code for more details. Automattic or WooCommerce support services are also not available to assist with the use of this code.

WooCommerce Subscriptions Upstage

Using WooCommerce Subscriptions? Need to test automatic payments on a staging site?

By default, when WooCommerce Subscriptions detects a change in a site's URL, it switches to Staging Mode. In Staging Mode, all subscriptions are forced to use manual renewals. This prevents accidental, duplicate renewal payments being processed by staging sites.

On occasion, there is a need to process automatic payments on staging sites, generally for testing.

This plugin can be used to trigger automatic payments for specific subscriptions when Subscriptions is in Staging Mode.

Usage

  1. Download the latest version of the plugin
  2. Install & activate the plugin
  3. Define a WCS_UPSTAGED_SUBSCRIPTION_IDS constant
  4. Set its value to a JSON encoded array of subscription IDs (int's) - it needs to be JSON encoded to avoid PHP Warning: Constants may only evaluate to scalar values errors

Automatic renewal payments will then be triggered for those subscription IDs.

Example Usage

define( 'WCS_UPSTAGED_SUBSCRIPTION_IDS', json_encode( array( 123, 5813, 2134 ) ) );

Suggested Usage

While the WCS_UPSTAGED_SUBSCRIPTION_IDS constant can be defined anywhere, your site's wp-config.php file is often the best place for defining this type of constant.

Requirements

The plugin will only trigger automatic payments when:

  • the site is in Staging Mode, it does nothing when the site is in Live Mode
  • a WCS_UPSTAGED_SUBSCRIPTION_IDS constant is defined
  • the WCS_UPSTAGED_SUBSCRIPTION_IDS constant is a JSON encoded array

If those conditions are met, when a scheduled renewal event occurs for a subscription in the WCS_UPSTAGED_SUBSCRIPTION_IDS array, this plugin will trigger the automatic renewal payment process.

Reporting Issues

If you find an problem or would like to request this plugin be extended, please open a new Issue.


About

Disable Staging Mode for specific subscriptions, as defined in a WCS_UPSTAGED_SUBSCRIPTION_IDS constant.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages