将 新订单电子邮件通知附件添加到供应商电子邮件



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

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

谢谢

您可以使用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;
}

您将需要自定义此自定义挂钩功能以动态获取电子邮件...

代码进入函数.php活动子主题(或主题(的文件或任何插件文件中。

此代码经过测试并有效

您也可以使用woocommerce_email_attachments过滤器钩...查看此相关线程

最新更新