A helper plugin for resetting all the next payment dates and pushing them back 1 minute.
Helps solve issues resulting in duplicate subscription renewal payments due to timezones.
All props go to @mattallan for this one.
To install:
- Download the latest version of the plugin here
- Go to Plugins > Add New > Upload administration screen on your WordPress site
- Select the ZIP file you just downloaded
- Click Install Now
- Click Activate
Please test on a dev/staging site and be sure to backup first. Please, no cowboys.
Once activated the plugin has three modes of operation:
- Log: log the subscriptions that will be reset
- Reset and Rollback: actually reset the subscription dates, but rollback the changes to test the actual performance
- Reset Dates: actually reset the subscription dates
We recommend running Log first and checking subscriptions prior to considering running Update.
You can initiate each of these modes via the Plugin Action Links below the plugins name on the Plugins administration screen.
To generate a list of subscriptions that will be updated, from the WordPress Admin Dashboard navigate to the plugin page and click the Log the reset (does not update anything)
plugin action link.
Once the page completes loading you'll be directed to the WooCommerce System Status log viewer page and can access the log file timezone-next-payment-date-fixer-<random string>
.
To test the update process we've also added the ability to run the update process and the roll back the changes. From the WordPress Admin Dashboard navigate to the plugin page and click the Reset and rollback
plugin action link.
Once the page completes loading you'll be directed to the WooCommerce System Status log viewer page and can access the log file timezone-next-payment-date-fixer-<random string>
.
The subscriptions will not be updated.
Please ensure you test and backup before running Update on a production site/environment
To update the next payment dates (i.e. to those values identified in log mode), from the WordPress Admin Dashboard navigate to the plugin page and click the RESET THE NEXT PAYMENT DATES!
plugin action link.
Once the page completes loading you'll be directed to the WooCommerce System Status log viewer page and can access the log file timezone-next-payment-date-fixer-<random string>
.
The subscriptions will be updated.
By default, all active subscriptions will have their dates reset. If you wish to restrict the reset to only specific subscriptions, you can define a constant array containing those subscription IDs.
For example, to restrict the reset to only subscriptions 1, 2 and 3, the following snippet can be added to the theme's functions.php
file temporarily:
define( 'WCS_SUBSCRIPTION_IDS_FOR_DATE_RESET', array( 1, 2, 3 ) );
Depending on the number of active subscriptions on the site AND what browser you are using you may need to modify the batch size from 10 to something else to get around browser redirect limits ref: http://stackoverflow.com/questions/9384474/in-chrome-how-many-redirects-are-too-many.
For example using Firefox to run the update on a site with 561 active subscriptions you would need a batch size of 30 (561/30 = 18.7) to safely get under the 20 redirect limit in the browser. Leaving it as 10 results in error message and process will not finish.