woocommerce-已完成的订单电子邮件-如果是定期付款,请不要发送 [英] woocommerce - completed order email - don't send if it's recurring payment

查看:73
本文介绍了woocommerce-已完成的订单电子邮件-如果是定期付款,请不要发送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Subscriptio插件在WooCommerce上运行的订阅服务,并且我不想发送续订电子邮件.它们与已完成订单"电子邮件完全相同.

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.

我要寻找的是一个挂接/筛选器,类似于 woocommerce_email_completed_order ,它将阻止发送续订电子邮件.

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

我确信它非常简单,但是该钩子/过滤器只是逃避了我的Google搜索!:)

I am sure it's supereasy, but that hook/filter just escapes my Google searches! :)

推荐答案

我们弄清楚了如何做到这一点.您必须在 woocommerce_email 操作中对 woocommerce_order_status_completed_notification 使用 remove_action().

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");

希望有帮助!

这篇关于woocommerce-已完成的订单电子邮件-如果是定期付款,请不要发送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆