Take the 2-minute tour ×
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

1 Answer 1

up vote 3 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

Your Answer

 
discard

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.