ecommerce WooCommerce Wordpress

[SOLVED] How to trigger emails of Failed Orders in WooCommerce

Update on February 3rd, 2016:

As of version 2.5 of WooCommerce, this functionality is now built into the WC Core. This plugin is not needed. See the WC 2.5 Changelog for more details.


Following the lead from this blog post by SkyVerge, I set upon to create email notifications when an order fails. Essentially, any time the credit card fails or the order processing is not successful, WooCommerce should notify the store owner that the order has failed.

Currently, WooCommerce is silent about Failed Orders. Note that there is a built in setting in WooCommerce for notifications about Canceled Orders, but not Failed Orders.

My first attempt at trying to modify this plugin by Justin Stern, failed. I tried to adapt the plugin for “Failed” instead of “Cancelled”. However, just replacing the instances of “Canceled” with “Failed” did not accomplish my objective.

After a lot of experimenting, I gave up and sought the help from the WooCommerce community. One of the most helpful WooNinjas, Caleb Burks, lent me a hand for this one. I take no credit for this. All I can say is that guy knows his coding very well.

In the future, I will try to explain the code. For now, here is the link to the completed plugin that sends out emails immediately after an order transitions into Failed status. To test this, simply change the status of an order to “Failed”. Emails should be fired off to the store owner.

Good luck to you. Let me know if it works or if you experience problems. This does work on my setup: WordPress 4.3.1, WooCommerce 2.4.6.


By Amit Ramani

Ever heard of 'tech and tack' together in the same sentence? Chances are you did not. I am part owner of a 'tack' store in Wellington (TACKNRIDER), and full owner of a 'tech' firm(ANTERIK).

11 replies on “[SOLVED] How to trigger emails of Failed Orders in WooCommerce”

Thanks for informative article. I am wondering how can I accomplish custom email for custom order status. I have looked through many articles but not find any satisfactory answer. Help would be appreciated.

I think it should be fairly straightforward to extend this example code to suit it for your needs. If you have created the custom order status, you just need to fire off the appropriate action hooks to trigger the custom emails.

Thanks Amit!

I want to send an email to customers when their orders change to cancelled (from pending, on hold or failed) because of no payment.

Is this the best way still to do it, creating a new email class for that?

I have it working right now with a few alterations, but I wonder if it’s the best way to do it 4 years later?


Hi Santiago
Sorry for the late reply. To the best of my knowledge, this method still works. Did you find otherwise? I am sorry I can not answer whether this is the ideal way to do this.

Leave a Reply

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