简体   繁体   English

如何在新订单中将客户的所有详细信息发送给管理员,并将客户的一些详细信息发送给供应商 email

[英]How to send all the details of customers to admin and few details of customers to vendor in new order email

I am using following WooCommerce function to send customer details in an email to admin and vendor when the new order is created.创建新订单时,我正在使用以下 WooCommerce function 将 email 中的客户详细信息发送给管理员供应商

<?php 
/**
* WooCommerce new order email customer details
*/
function filter__woocommerce_email_customer_details_fields( $fields, $sent_to_admin, $order ) {

    if ( empty( $fields ) ) {

        if ( $order->get_billing_email() ) {
            $fields['billing_email'] = array(
            'label' => __( 'Email address', 'woocommerce' ),
            'value' => wptexturize( $order->get_billing_email() ),
            );
        }
        if ( $order->get_billing_phone() ) {
            $fields['billing_phone'] = array(
            'label' => __( 'Phone', 'woocommerce' ),
            'value' => wptexturize( $order->get_billing_phone() ),
            );
        }
        if ( $order->get_customer_note() ) {
            $fields['customer_note'] = array(
            'label' => __( 'Customer note', 'woocommerce' ),
            'value' => wptexturize( $order->get_customer_note() ),
            );
        }

    }

    return $fields;
}
add_filter( 'woocommerce_email_customer_details_fields', 'filter__woocommerce_email_customer_details_fields', 10, 3 );

But now I want customization like when a new order email is sent to admin then all 3 details ( Email, Telephone and Notes ) need to send to admin, But only 2 details ( Emai and Notes ) need to send to Vendor但是现在我想要定制,比如当新订单 email 发送给管理员时,所有 3 个详细信息(Email,电话和便笺)都需要发送给管理员,但只有 2 个细节(Emai 和便笺)需要发送给供应商

I am using YITH WooCommerce Multi Vendor plugin which sends order email to a particular vendor我正在使用YITH WooCommerce 多供应商插件,它将订单 email 发送给特定供应商

How do I check that if an email is sent to admin then send all 3 details and if an email is sent to the vendor then send only 2 details?如何检查是否将 email 发送给管理员,然后发送所有 3 个详细信息,如果 email 发送给供应商,则仅发送 2 个详细信息?

Phone field should be sent to admin only and other fields to all.电话字段应仅发送给管理员,其他字段应发送给所有人。 Your have to add condition to if construction for this.您必须为此添加if (I think $sent_to_admin is boolean value described should current message be sent to admin). (我认为$sent_to_admin是 boolean 值,如果当前消息发送给管理员,则描述)。

if ( $order->get_billing_phone() && $sent_to_admin ) {
    $fields['billing_phone'] = array(
        'label' => __( 'Phone', 'woocommerce' ),
        'value' => wptexturize( $order->get_billing_phone() ),
    );
}

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

相关问题 不要通过管理员中的电子邮件opencart 2.3.0.2向客户发送电子邮件 - Dont Send email for customers by email opencart 2.3.0.2 in admin 如何仅在管理员订单详细信息中显示 email 中的产品类别 - How to show the products categories in email on admin order details only 如何在order-details.php中获取供应商详细信息? - How to get vendor details in order-details.php? Woocommerce管理员订单页面详细信息-电子邮件不起作用 - Woocommerce admin order page details - Email is not working 如何在客户和客人的管理订单列表中添加第一个订单列 - How to add a first order column to the admin order list for customers and guests 如何在Woocommerce中自动发送客户发票/订单明细电子邮件通知 - How to send Customer invoice / Order details email notification Automatically In Woocommerce 如何将表单详细信息发送到数据库以及如何发送包含表单详细信息的电子邮件CodeIgniter - How to send form details to database and send email with form details CodeIgniter 如何从Magento CSV导入客户发送新密码 - How to send new password from Magento CSV import of Customers 将表单详细信息发送到电子邮件 - Send form details to email Magento,列出一些订单详细信息 - Magento, list a few order details
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM