如何在 Woocommerce -> 订单后端页面上添加列

How To add column on Woocommerce -> Orders backend page

找不到可以将示例列添加到后端订单列表的有效解决方案。已经尝试过这些(在儿童主题 functions.php 内):

add_filter('manage_edit-shop_order_columns', 'extra_column');
function extra_column($columns) {
    $columns['title'] = 'Product-x';
    return $columns;
}

add_filter( 'manage_edit-shop_order_columns', 'MY_COLUMNS_FUNCTION' );
function MY_COLUMNS_FUNCTION($columns){
    $new_columns = (is_array($columns)) ? $columns : array();
    unset( $new_columns['order_actions'] );

    //edit this for you column(s)
    //all of your columns will be added before the actions column
    $new_columns['MY_COLUMN_ID_1'] = 'MY_COLUMN_1_TITLE';
//    $new_columns['MY_COLUMN_ID_2'] = 'MY_COLUMN_2_TITLE';
    //stop editing

    $new_columns['order_actions'] = $columns['order_actions'];
    return $new_columns;
}    

add_action( 'manage_shop_order_posts_custom_column', 'MY_COLUMNS_VALUES_FUNCTION', 2 );
function MY_COLUMNS_VALUES_FUNCTION($column){
    global $post;
    $data = get_post_meta( $post->ID );

    //start editing, I was saving my fields for the orders as custom post meta
    //if you did the same, follow this code
    if ( $column == 'MY_COLUMN_ID_1' ) {    
        echo (isset($data['MY_COLUMN_1_POST_META_ID']) ? $data['MY_COLUMN_1_POST_META_ID'] : '');
    }
    if ( $column == 'MY_COLUMN_ID_2' ) {    
        echo (isset($data['MY_COLUMN_2_POST_META_ID']) ? $data['MY_COLUMN_2_POST_META_ID'] : '');
    }
}

add_filter( 'manage_edit-shop_order_columns', 'imarcon_set_custom_column_order_columns');

function imarcon_set_custom_column_order_columns($columns) {
// global $woocommerce;
$nieuwearray = array();
 foreach($columns as $key => $title) {
   if ($key=='billing_address') // in front of the Billing column
     $nieuwearray['order_producten']  = __( 'Products', 'woocommerce' );
    $nieuwearray[$key] = $title;
  }
    return $nieuwearray ;
}

我正在使用 WP 4.1.1、启用了子主题的 Avada 3.7.3、Gravity Forms 1.8.22 + 一些 WooCommerce 插件和其他插件。

好的,知道了 - Woocommerce 更新解决了它。