将新订单电子邮件通知附件添加到供应商电子邮件 [英] Add the New order email notification attachment to the vendor email

查看:188
本文介绍了将新订单电子邮件通知附件添加到供应商电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 WooCommerce 中,我使用 woocommerce-product-vendors 作为多供应商插件.结帐后,我以管理员身份收到一封带有附件(上传文件)的新订单电子邮件通知.

In WooCommerce, I use woocommerce-product-vendors as multi vendor plugin. After checkout I receive as admin an a new order email notification with the attachment (uploaded file).

但供应商收到相同的电子邮件,但没有附件.我需要供应商也收到附件.

But the vendor receive the same email but without the attachment. I need that the vendor receive the attachment too.

谢谢

推荐答案

您可以使用挂在 woocommerce_email_recipient_new_order 过滤器钩子中的自定义函数来尝试此代码:

You could try this code with a custom function hooked in woocommerce_email_recipient_new_order filter hook:

add_filter('woocommerce_email_recipient_new_order', 'adding_vendor_email', 10, 2);
function adding_vendor_email( $recipient, $order ) {
    if ( ! is_a( $order, 'WC_Order' ) ) return $recipient; // (Optional)

    // Your code or conditions to get the vendor email (if needed)

    $recipient .= ",vendor@yourdomain.com";
    return $recipient;
}

您需要自定义此自定义挂钩函数以动态获取电子邮件...

You will need to customize this custom hooked function to get the email dynamically…

代码位于活动子主题(或主题)的 function.php 文件或任何插件文件中.

此代码已经过测试并有效

This code is tested and works

您也可以使用 woocommerce_email_attachments 过滤器钩子……参见 这个相关主题

You could also use woocommerce_email_attachments filter hook… see this related thread

这篇关于将新订单电子邮件通知附件添加到供应商电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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