自动化WooCommerce订单电子邮件以及运输标签到仓库

时间:2018-05-27 21:33:47

标签: php wordpress woocommerce orders email-notifications

我想知道(之前从未使用过Woocommerce)关于WC订单流程的事情。

我正在考虑管理Woocommerce和Wordpress所在网站的后端,并希望找到一种方法,通过电子邮件将订单自动化到另一个位置的仓库/运输部门。

我并非真的希望他们能够访问后端,因为他们不了解它/从未使用它。

理想情况下,我们还希望将(加拿大邮政)发货标签与订单电子邮件通知一起发送。

(订单进入woocommerce>电子邮件被发送转发订单到仓库进行处理/发货)

我有办法实现这个目标吗?

1 个答案:

答案 0 :(得分:0)

要在处理订单电子邮件通知中将Blind Carbon Copy(BCC)中的电子邮件发送到仓库/运输部门,您将使用此自定义挂钩功能:

// Add a custom hidden email to processing email notification
add_filter( 'woocommerce_email_headers', 'warehouse_shipping_email_notification', 20, 3 );
function warehouse_shipping_email_notification( $header, $email_id, $order ) {
    // Only for customer processing order notification
    if( 'customer_processing_order' != $email_id ) return $header;

    // HERE below set the warehouse/shipping name and email address
    $name = 'Macfilish Warehouse Shipping';
    $email = 'shipping@macfilish.com';

    // Add warehouse email to BCC
    $header .= 'Bcc: ' . utf8_decode($name . ' <' . $email . '>') . "\r\n";

    return $header;
}

代码放在活动子主题(或活动主题)的function.php文件中。经过测试和工作。

  

由于我从未使用过Woocommerce Canada Post扩展程序,因此我无法向您提供包含运输标签的任何帮助......