[英]Display checkout field value in Woocommerce admin order list custom column
[英]Add a custom field in Woocommerce admin order list "Order" existing column
更新 - 2018年11 月- 添加了與 Woocommerce 3.3+ 版的兼容性
這可以在manage_shop_order_posts_custom_column
動作掛鈎中掛鈎自定義函數。 下面我將計費電話添加到現有的訂單(“Pedido”)列數據中:
add_action( 'manage_shop_order_posts_custom_column' , 'custom_orders_list_column_content', 10, 2 );
function custom_orders_list_column_content( $column, $post_id ) {
if ( $column == 'order_title' || $column == 'order_number' )
{
// The billing phone for example (to be repaced by your custom field meta_key)
$custom_field_value = get_post_meta( $post_id, '_billing_phone', true );
if( ! empty( $custom_field_value ) )
echo $custom_field_value;
}
}
*代碼位於您的活動子主題(或活動主題)的 function.php 文件中。 測試和工作
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.