This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

CloudwaysCDN — a powerful solution that offers superior performance and satisfied global audience for your business. Read More

WooCommerce Subscription Status On Hold

Updated on  26th September

2 Min Read
Reading Time: 2 minutes

It is easy to setup subscription payments on WooCommerce stores. In many cases, subscription payments set up recurring payments that could be collected at preset intervals.

WooCommerce Subscription activates when the order changes to Processing (and above). This is ideal for subscription based payment models but not so great for Cash on Delivery (CoD) payment option.

WooCommerce Subscription Status On Hold

In the case of CoD, the order status moves directly to Processing. This means that the buyer would have access to the product even before the payment is cleared. This often proves to be a challenge for ecommerce stores that operate on subscription model.

In many cases, store owners need to put this behavior on hold so that they could collect the payment before product is delivered. Fortunately, WooCommerce offers a simple way of implementing this behavior.

Put the following code snippet into the functions.php, which is located in the theme folder.

Code Explanation

The code snippet starts with checking the payment gateway. If the CoD option is selected, it further checks the order status. If the order status is not Completed, the code changes the subscription status to On Hold.

Because of this change in the subscription status, the customer will not be able to use the product/service before the payment is received. The good thing is that there is no need to manually change the subscription status once the payment has been received. Once the status of the order changes to Completed, the subscription’s status changes to Active.

Conclusion

In this tutorial, I covered the scenario where the subscription status affects product delivery. By using a simple code snippet, the store owners could modify the status of the order to ensure that payments have been received before product delivery.if you need any help with the idea, do leave a comment below.

Share your opinion in the comment section. COMMENT NOW

Owais Alam

is the WordPress Community Manager at Cloudways - A Managed WooCommerce Hosting Platform and a seasoned PHP developer. He loves to develop all sorts of websites on WordPress and is in love with WooCommerce in particular. You can email him at owais.alam@cloudways.com

Start Growing with Cloudways Today.

Our Clients Love us because we never compromise on these

Get Our Newsletter
Be the first to get the latest updates and tutorials.

THERE’S MORE TO READ.