Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a WooCommerce site to sell subscription products. I customized the emails and want to test them out in my email client. Currently I have created a test subscription that renews every day (24 hours). This means I need to wait 24 hours to test my renewal emails.

How can I trigger these emails so that I can speed up my development and testing process?

share|improve this question

2 Answers 2

up vote 4 down vote accepted

To trigger an off-schedule renewal and therefore trigger the renewal order email, please follow these steps:

  1. Purchase the test subscription with either Stripe or a gateway that requires manual renewal payments (e.g. Cheque, Bank transfer). PayPal won't work.
  2. Find the subscription key for the newly purchased subscription.
  3. Delete the wcs_blocker_{$user_id}_($subscription_key} transient from the database (where $user_id is the ID of the customer who purchased the subscription).
  4. Install & activate the WP-Crontrol plugin
  5. Visit the Tools > Crontrol admin screen
  6. Find the WP-Cron job with the scheduled_subscription_payment hook and matching user ID & subscription key to the test subscription.
  7. Click the Run Now link next to the appropriate WP-Cron job

And that should trigger the renewal early.

This may sound harder than it should be to simply trigger a renewal order email, but there are safeguards to ensure payments are not charged on an incorrect schedule, so to force payments to charge out-of-schedule, you have to remove those safeguards and then trigger the renewal.

share|improve this answer
That's awesome! Totally understand the safeguards. Thanks for the tip Brent, and thanks for putting the Subscriptions extension out for us :) – blogjunkie Feb 6 '13 at 4:48

Now in latest version of Woocommerce Subscription plugin, testing Subscription Renewal is more easy. Just follow these steps and you are done;

Step 1. Purchase a Test Subscription

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.

Step 2. Switching to Debug mode

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:

if ( ! defined( 'WP_DEBUG' ) ) {
    define( 'WP_DEBUG', true );

Detailed instructions on how to do this can be found in the Codex article on debugging.

To switch WooCommerce Subscriptions into debugging mode, add the following code to your site's wp-config.php file:

if ( ! defined( 'WCS_DEBUG' ) ) {
    define( 'WCS_DEBUG', true );

Step 3. Triggering the Renewal

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 {order_id}_ i.e. the ID of the order in which the subscription was purchased followed by an underscore. For example, for a subscription purchased in order 3125, the search string is 3125_. Find the row with the hook scheduled_subscription_payment and the status pending. Hover over the row and and click Run

Step 4. Cleaning Up

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 - one on the original schedule and another on a new schedule based on the time of running the action (i.e. now).

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.

For more details you can visit this original article by Plugin Author.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.