WooCommerce Follow-Ups allows store owners to send emails after a renewal order goes into a failed status with the idea being that a subscriber would need to resolve whatever is causing the renewal payment to fail. The same WooCommerce extension provides some settings for these emails to remove them (not send) if the order status changes. That’s fine until the subscriber cancels their subscription and then ends up getting an email. A status change of a subscription is not the same as the status change of an order. Follow-Ups uses order statuses exclusively and pays no attention whatsoever to Subscription statuses or status changes.
Fortunately, WooCommerce Subscriptions provides an action hook named
woocommerce_subscription_pre_update_status which passes the old status, the new status, and an instance of the subscription itself.
Follow-ups provides a method for handling this named
remove_subscription_payment_failed_email and that is part of the
To put all of that together, one might use something similar to the code snippet below to automatically remove subscription related emails when the subscription is canceled by the user:
Not sure what to do with code snippets? See What Do I Do With These Code Snippets?
Leave a Reply
You must be registered and logged in to post a comment.