For a non-technical method to test subscription renewal payments, please refer to the Process Renewal Action covered in the Store Manager Guide.
Once you have WooCommerce Subscriptions active on your site, you may want to test subscription renewal.
When using a payment gateway other than PayPal or WorldPay, you don’t have to wait 24 hours (the minimum billing period) for a renewal to be processed. However, if you are using PayPal or WorldPay, this process will not work and you must wait until the payment gateway processes the renewal (which can be anywhere from 24 to 48 hours after the purchase of a daily subscription in PayPal’s case).
Purchase a Test Subscription ↑ Back to top
If you have not already purchased a subscription to test, purchase a test subscription using the payment gateway you wish to test. After completing the purchase, take note of the order number for the subscription.
Switch to Debug mode ↑ Back to top
The first step to testing renewals is to switch your site into debug mode. To switch WordPress into debugging mode, add the following lines of code to your site’s wp-config.php file:
define( 'WP_DEBUG', true );
Detailed instructions on how to do this can be found in the Codex article on debugging.
Triggering the Renewal ↑ Back to top
Now you have a test subscription and your site is in debug mode, you can trigger the renewal.
- Visit your site’s administration dashboard.
- Go to: Tools > Scheduled Actions.
- In the search box, enter subscription ID.
- Find the row with the hook ‘woocommerce_scheduled_subscription_payment’ and the status pending.
- Hover over the row and and click Run
Cleaning Up ↑ Back to top
In versions of Subscriptions prior to 2.1.3, once you have triggered the renewal successfully, if the subscription renewal processed correctly with an automatic renewal method, you will end up with two pending scheduled_subscription_payment actions.
You can find and trash either of these actions from the Scheduled Actions screen. Which scheduled action you choose to trash depends on which schedule you wish to keep.