简体   繁体   English

WooCommerce完成订单上的其他电子邮件

[英]WooCommerce additional email on completed order

I have a question, which need a community support as I couldn't find anything on the web including WooCommerce support forum. 我有一个问题,需要社区支持,因为我在网上找不到任何东西,包括WooCommerce支持论坛。

I have a WooCommerce site which is a closed e-commerce store used by local chain of restaurants. 我有一个WooCommerce网站,这是一家本地连锁餐馆使用的封闭式电子商务商店。 Each time stores order anything, GM would also like a email sent to him on completed order, so he can either block the order or approve it. 每次存储订单时,GM都会希望收到一封已完成订单的电子邮件,因此他可以阻止或批准该订单。 GM1 is responsible for Store1, Store2 and Store3; GM1负责Store1,Store2和Store3; GM2 is responsible for Store4, Store5, and Store 6 and so forth. GM2负责Store4,Store5和Store 6等。

With the help of internet, this is what I have so far in function.php. 借助互联网,到目前为止,这是我在function.php中拥有的内容。 Function is working properly and getting triggered, but all 3 GMs are getting email, but in theory, only one GM should get email. 功能正常运行并被触发,但是所有3个GM都收到电子邮件,但从理论上讲,只有一个GM应该收到电子邮件。 GM1 for Store1 OR Store2 OR Store3; 商店1或商店2或商店3的GM1; and GM2 should get email if Store4 OR Store5 OR Store6 orders. 如果Store4或Store5或Store6订单,GM2和GM2应该会收到电子邮件。

Really appreciate if somebody can point me to the right direction or atleast let me know why all three ifs are getting triggered. 如果有人可以将我指向正确的方向,或者至少让我知道为什么所有三个ifs都被触发,我将非常感激。

add_filter( 'woocommerce_email_recipient_customer_completed_order', 'your_email_recipient_filter_function', 10, 2);

function your_email_recipient_filter_function($recipient, $object) {
    if( 'Store1@store.com' || 'Store2@store.com' || 'Store3@store.com' == $recipient ){
        $recipient = $recipient .= ', GM1@store.com';
    }

    if( 'Store4@store.com' || 'Store5@store.com' || 'Store6@store.com' == $recipient ){
        $recipient = $recipient .= ', GM2@store.com';
    }

    if( 'Store7@store.com' || 'Store8@store.com' || 'Store9@store.com' == $recipient ){
        $recipient = $recipient .= ', GM3@store.com';
    }

    return $recipient;
}

Thanks. 谢谢。

I ended up using an array() as below which seems to be working: 我最终使用如下所示的array()似乎正在工作:

function your_email_recipient_filter_function( $recipient, $order ) {

$Stores1 = array('Store1@store.com', 'Store2@store.com', 'Store3@store.com');
$Stores2 = array('Store4@store.com', 'Store5@store.com', 'Store6@store.com');
$Stores3 = array('Store7@store.com', 'Store8@store.com', 'Store9@store.com');

$StoreEmail =  $order->billing_email;

if ( in_array( $StoreEmail, $Stores1)) {
    $recipient .= ', GM1@store.com';
} elseif ( in_array( $StoreEmail, $Stores2) ) {
    $recipient .= ', GM2@store.com';
} elseif ( in_array( $StoreEmail, $Stores3) ) {
    $recipient .= ', GM2@store.com';
} 
return $recipient;
}
add_filter( 'woocommerce_email_recipient_customer_completed_order', 'your_email_recipient_filter_function', 10, 2);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Woocommerce订单已完成电子邮件通知 - Woocommerce Order Completed Email notification WooCommerce:在完成的订单中添加第二个电子邮件地址 - WooCommerce: Adding a second email address to a completed order 从Woocommerce中已完成的订单电子邮件通知中删除订单明细表 - Remove order details table from completed order email notification in Woocommerce 根据 Woocommerce 中的付款类型将新订单电子邮件发送到其他电子邮件 - Send New Order email to an additional email based on payment type in Woocommerce 定位WooCommerce客户处理和完成的订单电子邮件通知 - Targetting WooCommerce customer processing and completed order email notifications 将可变产品的“描述”字段内容添加到 woocommerce “已完成订单” email - Add "description" field contents for variable product to woocommerce "Completed order" email 以编程方式创建“已完成”订单,无需将 email 发送给 WooCommerce 中的客户 - Create programmatically a “completed” order without sending email to customer in WooCommerce 如何在 WooCommerce 中的已完成订单 email 模板中添加新帐户信息 - How to add new account info on order completed email template in WooCommerce woocommerce-已完成的订单电子邮件-如果是定期付款,请不要发送 - woocommerce - completed order email - don't send if it's recurring payment 隐藏WooCommerce电子邮件已完成订单通知中的付款说明 - Hide payment instructions from WooCommerce email completed order notifications
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM