将 "Order" 列中的客户电子邮件和 phone 添加到 Woocommerce 上的管理员订单列表
Add customer email and phone in "Order" column to admin orders list on Woocommerce
我正在尝试找到一种方法,了解如何在 WooCommerce 订单视图中的姓名下方添加客户 phone 和电子邮件。请参阅图片以供参考,我需要在其中添加此信息。
关于如何实现这一目标的任何想法、提示或指示?
以下代码将在后端订单列表中的订单号下添加账单 phone 和电子邮件 (仅适用于 Woocommerce 3.3+):
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 文件。已测试并有效。
谢谢,工作完美。
我已经根据自己的需要修改了,在这里添加代码以供其他人使用。
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>Mobile: '.'<a href="tel:'.$phone.'">' . $phone.'</a></strong>';
}
if( $email = $the_order->get_billing_email() ){
echo '<br>Email: '.'<a href="mailto:'.$email.'">' . $email . '</a>';
}
}
}
我正在尝试找到一种方法,了解如何在 WooCommerce 订单视图中的姓名下方添加客户 phone 和电子邮件。请参阅图片以供参考,我需要在其中添加此信息。
关于如何实现这一目标的任何想法、提示或指示?
以下代码将在后端订单列表中的订单号下添加账单 phone 和电子邮件 (仅适用于 Woocommerce 3.3+):
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 文件。已测试并有效。
谢谢,工作完美。 我已经根据自己的需要修改了,在这里添加代码以供其他人使用。
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>Mobile: '.'<a href="tel:'.$phone.'">' . $phone.'</a></strong>';
}
if( $email = $the_order->get_billing_email() ){
echo '<br>Email: '.'<a href="mailto:'.$email.'">' . $email . '</a>';
}
}
}