将新订单电子邮件通知附件添加到供应商电子邮件
Add the New order email notification attachment to the vendor email
在 WooCommerce 中,我使用 woocommerce-product-vendors 作为多供应商插件。结帐后,我作为管理员收到一封新订单电子邮件通知,其中包含附件(上传的文件)。
但供应商收到相同的电子邮件,但没有附件。我需要供应商也收到附件。
谢谢
您可以使用挂接到 woocommerce_email_recipient_new_order
过滤器挂钩的自定义函数来尝试此代码:
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;
}
您需要自定义此自定义挂钩函数才能动态获取电子邮件……
代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件。
此代码已经过测试并且有效
You could also use woocommerce_email_attachments
filter hook… see this related thread
在 WooCommerce 中,我使用 woocommerce-product-vendors 作为多供应商插件。结帐后,我作为管理员收到一封新订单电子邮件通知,其中包含附件(上传的文件)。
但供应商收到相同的电子邮件,但没有附件。我需要供应商也收到附件。
谢谢
您可以使用挂接到 woocommerce_email_recipient_new_order
过滤器挂钩的自定义函数来尝试此代码:
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;
}
您需要自定义此自定义挂钩函数才能动态获取电子邮件……
代码进入您的活动子主题(或主题)的 function.php 文件或任何插件文件。
此代码已经过测试并且有效
You could also use
woocommerce_email_attachments
filter hook… see this related thread