在WooCommerce中,我使用woocommerce-products-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文件中,或者放在任何插件文件中 .
此代码经过测试和运行
您也可以使用woocommerce_email_attachments过滤器钩子...请参阅此相关主题
1 回答
您可以使用 woocommerce_email_recipient_new_order 过滤器钩子中挂钩的自定义函数来尝试此代码:
您需要自定义此自定义钩子函数以动态获取电子邮件...
代码放在活动子主题(或主题)的function.php文件中,或者放在任何插件文件中 .
此代码经过测试和运行