WooCommerce 订阅电子邮件:正确的 'woocommerce_email_order_details' 挂钩函数参数是什么(修改 "renewal" 电子邮件)?

WooCommerce Subscriptions Emails: What are the correct 'woocommerce_email_order_details' hook function arguments (to modify "renewal" emails)?

我无法追踪 modify/add 电子邮件内容的正确挂钩函数参数(特定于 WooCommerce 订阅)'customer_renewal_invoice' 和 'processing_renewal_order' [=] 中的电子邮件 ID 38=]勾.

我对标准的 WooCommerce 订单电子邮件有此工作(即电子邮件内容修改),但根据 LoicTheAztec (),订阅插件使用不同的钩子函数参数;我只是不知道那些是什么。

这是我现有内容的简化版本:

add_action ('woocommerce_email_order_details', 'custom_email_notification', 5, 4);
function custom_email_notification( $order, $sent_to_admin, $plain_text, $email ){
    if ( 'customer_processing_order' == $email->id || 'customer_invoice' == $email->id || 'customer_on_hold_order' == $email->id || 'customer_renewal_invoice' == $email->id || 'processing_renewal_order' == $email->id ){
        echo "Extra content here";
    }
}

前三个 "standard"/WooCommerce 电子邮件 ID 正确参与,但最后两个(特定于 WooCommerce 订阅插件)从未 engage/trigger;我知道这是因为我的钩子参数不正确,但我不知道如何更正它们。

我觉得这些其他帖子中提到了我需要的信息的本质,但我不能完全将所有部分放在一起;按感知相关性的顺序列出:

WooCommerce Subscription Cancellation Email to Customer

我的生活不断 easier/bearable 得益于 Whosebug 上用户的难以置信的帮助;谢谢大家,并在此先感谢您就此问题提供的任何帮助。

我想你可能真的想要 woocommerce_subscriptions_email_order_details,它似乎是从你想要的两封电子邮件中调用的(templates/emails/customer-renewal-invoice.php 和 templates/emails/customer-processing-renewal-order.php).在这两个中,它都收到 $order, $sent_to_admin, $plain_text, $email。但是如果你想处理任何其他情况,有时它会在其他地方用 $subscription, $sent_to_admin, $plain_text, $email.

调用