Recently I discovered AutomateWoo, which instantly became my favorite marketing automation plugin for WooCommerce.
I use it heavily on WP Desk and Flexible Shipping.
I am also working much on improving renewal conversion rates for our plugins. I wanted to use AutomateWoo to send email to customers whose subscription got cancelled. I include a small discount coupon in these emails to give incentive to renew the plugin license.
I set up the workflow like this:
I was quite happy with it, however later I discovered that this workflow also fires for subscriptions which get cancelled by a refund. While WooCommerce orders distinguish cancelled and refunded status, WooCommerce Subscriptions does not. The subscription gets cancelled and there is no information if the parent order was cancelled or refunded.
It quite obvious that you do not want to send coupons to customers who you’ve just given a refund and they do not plan to use your products.
I wrote a ticket to AutomateWoo and they came with a solution, however it made me setup 2 workflows and tag users which orders were refunded. It was to complicated for such a basic feature.
So I dig in their docs and it turns out that you can create custom rules. Brilliant!
So I wanted a rule that would check the parent order of the cancelled subscription and only send the email if the order status is not refunded. You can find the complete code below.
Now my workflow looks like that:
Please also refer to the official AutomateWoo tutorial about custom rules to help you get started.
Jay says
Hey! Looks great, thanks for the explanation. I tried to implement the code but it doesn’t seem to show up in AutomateWoo. Having the same issue with another custom rule. Where do you need to place the ‘subscription-parent-order-status.php’ file? Just in the main child theme directory? Thanks a lot.
Maciej Swoboda says
Hi Jay, You can place it anywhere. I would suggest creating a new directory for AW files for better organization. Just make sure to update the file path in this line: $rules[‘subscription_parent_order_status’] = dirname(__FILE__) . ‘/subscription-parent-order-status.php’;