[英]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.