在“订单"中添加客户电子邮件和电话Woocommerce上的管理订单列表的列 [英] Add customer email and phone in "Order" column to admin orders list on Woocommerce

查看:58
本文介绍了在“订单"中添加客户电子邮件和电话Woocommerce上的管理订单列表的列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试找到一种方法,如何在WooCommerce订单视图上的名称下方添加客户电话和电子邮件.在需要添加此信息的地方,请参阅图片以供参考.

I am trying to find a way on how to add the customer phone and email below the name on the WooCommerce order view. See picture for reference where I need to add this information.

有关如何实现此目标的任何想法,技巧或指示?

Any ideas, tips or pointers on how to make this happen?

推荐答案

以下代码将在后台订单列表(仅适用于Woocommerce 3.3 +)中的订单号下方添加开票电话和电子邮件:

The following code will add the billing phone and email under the order number in backend orders list (for Woocommerce 3.3+ only):

add_action( 'manage_shop_order_posts_custom_column' , 'custom_orders_list_column_content', 50, 2 );
function custom_orders_list_column_content( $column, $post_id ) {
    if ( $column == 'order_number' )
    {
        global $the_order;

        if( $phone = $the_order->get_billing_phone() ){
            $phone_wp_dashicon = '<span class="dashicons dashicons-phone"></span> ';
            echo '<br><a href="tel:'.$phone.'">' . $phone_wp_dashicon . $phone.'</a></strong>';
        }

        if( $email = $the_order->get_billing_email() ){
            echo '<br><strong><a href="mailto:'.$email.'">' . $email . '</a></strong>';
        }
    }
}

代码进入您的活动子主题(活动主题)的function.php文件中.经过测试,可以正常工作.

Code goes in function.php file of your active child theme (active theme). Tested and works.

这篇关于在“订单"中添加客户电子邮件和电话Woocommerce上的管理订单列表的列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆