Search

How to Test WooCommerce Subscriptions on your Website

Listen to this article

test-woocommerce-subscriptions-blogSystem Testing‘ happens to be an integral component of the software testing process. But what happens when testing a system is dependent on an event that’s not going to occur anytime soon? How do you test the system then?

I’m mentioning this today as I happened to experience a similar situation recently while using the WooCommerce Subscriptions plugin. The plugin per se is perfect if you need to add a subscription functionality for products on your WooCommerce website without having to actually do any coding. Plug, play and you can get started.

However, the catch here is testing a certain functionality that is triggered at the end of a product’s subscription period. The Subscriptions plugin allows a minimum of one day subscription period for any product. This means every time you want to test some functionality that will be triggered after the subscription ends, you will have to wait for at least a day, which by all means is not feasible during the development as well as testing process.

Basically, what we need is a workaround to be able to test functionality that will be triggered after a product subscription ends as and when required.

The main question here is how to test WooCommerce Subscriptions on your website?

This can be done if there is a way to prematurely end a product subscription manually, and that’s exactly what I am going to explain in this post. To be able to do so the following steps will have to be taken through.

Step 1: Set Your Website Debug Mode On

  • Open your wp-config file and search for the following debug action.
define('WP_DEBUG', false);

  Here the false parameter will have to changed to true.

  • Once the change has been made add the following two lines of code to your config file. You can add it to the end of the file.
if ( ! defined( 'WCS_DEBUG' ) ) {
    define( 'WCS_DEBUG', true );
}
  • Lastly, don’t forget to save the file before closing it 🙂

Step 2: Trigger Subscription Renewal Process

  • The next step would be to manually trigger the subscription renewal process. To do so you will have to go to the website’s back end. Once here you go to Tools ? Scheduled Actions.
  • Here you will get the list of all the order actions that are scheduled to be fired at the end of a subscription period for a particular order.
  • Now you can search for your particular order for which you want to end the subscription.

Note: The list is not arranged date wise or in any other order so if you don’t find your required order on the first few pages the use the search facility to find it, and you will get your desired order with ease.

test-woocomerce-subscriptions-screenshot

  • Once you find your order that you want to end the subscription for, click ‘Run’. This event will end your subscription for that particular order. If the order is of type recurring then a new action will be created and scheduled for the same order id, otherwise it won’t. Instead, it will create a duplicate action of the same type of order that you fired. You can either delete the duplicate action or keep it the way it is. It will not really affect the functionality.

So, that was about how to test WooCommerce Subscriptions by manually ending the Subscription of a product in your WooCommerce store.

Sometimes it is the little things that can turn out to be the most time consuming. My main intention while writing this post on testing WooCommerce subscription products was to make these little things simpler for you. I hope the intention has been met. If it hasn’t then the comment section is always there.

Nikhil Vichare

Nikhil Vichare

2 Responses

  1. Hello Nikhil,
    Is this paid plugin or free for woocommerce Subscription testing . I am developer, so i want to test my custom payment gateway integration working or not. Recurring payments will be executed for every products after 24 hours but i am not having enough time.

Leave a Reply

Your email address will not be published. Required fields are marked *

Get The Latest Updates

Subscribe to our Newsletter

A key to unlock the world of open-source. We promise not to spam your inbox.

Suggested Reads

Join our 55,000+ Subscribers

    The Wisdm Digest delivers all the latest news, and resources from the world of open-source businesses to your inbox.

    Suggested Reads

    WordPress Tips & Tricks
    Ketan Vyawahare

    How to Make Responsive Tables using CSS without Tag Read More »