简体   繁体   English

WooCommerce 为 email 添加 email 订单元字段到管理员“新订单”

[英]WooCommerce add email order meta field just for email to admin "new order"

I added a custom field to all WooCommerce order mails but i dont want it to be shown to the emails to the customer bust just to the admin (new order mail).我向所有 WooCommerce 订单邮件添加了一个自定义字段,但我不希望它显示在发送给客户的电子邮件中,只显示给管理员(新订单邮件)。

/*----------------------------------------------
    Add Delivery Date Field to the order emails
-------------------------------------------------*/
add_filter('woocommerce_email_order_meta_fields', 'my_woocommerce_email_order_meta_fields', 0, 3 );

function my_woocommerce_email_order_meta_fields( $fields, $sent_to_admin, $order ) {
    $fields[ 'birthdate' ] = array(
        'label' => 'Geburtstag',
        'value' => $order->get_meta( '_billing_birthdate' )
    );

    return $fields;
}

$sent_to_admin = 1 , email being sent to admin, $sent_to_admin = 0 , email NOT being sent to admin. $sent_to_admin = 1 , email 被发送给管理员, $sent_to_admin = 0 , email 没有被发送给管理员。

    function my_woocommerce_email_order_meta_fields($fields, $sent_to_admin, $order) {
        if ($sent_to_admin) {
            $fields['birthdate'] = array(
                'label' => 'Geburtstag',
                'value' => $order->get_meta('_billing_birthdate')
            );
        }
    
        return $fields;
    }
add_filter('woocommerce_email_order_meta_fields', 'my_woocommerce_email_order_meta_fields', 0, 3);

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

相关问题 如何恢复发送到 WooCommerce 管理员的新订单的 email 中的元数据 - How to recover meta data in the email of new order sent to the WooCommerce admin 在Woocommerce中将订单交易ID添加到管理员新订单电子邮件通知中 - Add orders transaction id to admin new order email notification in Woocommerce 在管理新订单电子邮件模板中添加应用的优惠券代码 - WooCommerce - Add Applied Coupon Code in Admin New Order Email Template - WooCommerce WooCommerce:添加自定义字段以订购元和管理订单 - WooCommerce: add custom field to order meta and admin order 将公司名称添加到 WooCommerce “新订单” email - Add company name to WooCommerce "New Order" email 将 woocommerce optgroup 选择值添加到 email 订单管理订单 - add woocommerce optgroup selected value to email order an admin order Woocommerce 将订单注释添加到失败的订单管理员 email - Woocommerce add order notes to failed order admin email 在 WooCommerce 电子邮件订单元中获取自定义字段数组值 - Get a custom field array values within WooCommerce email order meta Woocommerce:获取元数据并仅放入新订单 email - Woocommerce: get post meta and put only in new order email 将订单总重量添加到WooCommerce新订单电子邮件通知中 - Add the order total weight to WooCommerce new order email notification
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM