WooCommerce Subscriptions Upstage
Disable Staging Mode for specific subscriptions, as defined in a WCS_UPSTAGED_SUBSCRIPTION_IDS constant.
by Prospress Inc. · github.com/prospress/woocommerce-subscriptions-upstage · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/prospress/woocommerce-subscriptions-upstage/archive/refs/heads/master.zipReadme
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
- Download the latest version of the plugin
- Install & activate the plugin
- Define a
WCS_UPSTAGED_SUBSCRIPTION_IDSconstant - Set its value to a JSON encoded array of subscription IDs (
int's) - it needs to be JSON encoded to avoidPHP 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_IDSconstant is defined - the
WCS_UPSTAGED_SUBSCRIPTION_IDSconstant 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.