woocommerce – completed order email – don’t send if it’s recurring payment

I have a subscription service running on WooCommerce, using the Subscriptio plugin and I don’t want to send the renewal order emails. They are exactly the same as Completed Order emails.

What I am looking for is a hook/filter, something like woocommerce_email_completed_order, that would prevent the renewal email from being sent.

Read More

I am sure it’s supereasy, but that hook/filter just escapes my Google searches! 🙂

Related posts

1 comment

  1. We figured out how to do this. You have to use remove_action() on woocommerce_order_status_completed_notification in the woocommerce_email action.

    So for you, something like this:

    // Conditionally remove action to send email
    function unhook_emails($email_class) {
    
        // Check whether to send the renewal email or not
        $send_renewal_email = check_send_renewal_email();
    
        if (!$send_renewal_email) {
    
            // Remove action to prevent email from being sent
            remove_action(
                "woocommerce_order_status_completed_notification",
                array(
                    $email_class->emails["WC_Email_Customer_Completed_Order"],
                    "trigger"
                )
            );
        }
    }
    
    add_action("woocommerce_email", "unhook_emails");
    

    Hopefully that helps!

Comments are closed.