How to edit woocommerce admin order page?
try this to your functions.php
add_filter( 'manage_edit-shop_order_columns', 'shop_order_columns' );
function shop_order_columns( $columns ){
$new_columns = (is_array($columns)) ? $columns : array();
$new_columns['phone'] = 'Phone';
return $new_columns;
}
add_action( 'manage_shop_order_posts_custom_column', 'shop_order_posts_custom_column' );
function shop_order_posts_custom_column( $column ){
global $post, $the_order;
if ( empty( $the_order ) || $the_order->get_id() != $post->ID ) {
$the_order = wc_get_order( $post->ID );
}
$billing_address = $the_order->get_address();
if ( $column == 'phone' ) {
echo ( isset( $billing_address['phone'] ) ? $billing_address['phone'] : '');
}
}
Position problem??..
try this for the first function
function shop_order_columns($columns){
$columns = (is_array($columns)) ? $columns : array();
$phone = array( 'phone' => 'Phone' );
$position = 5;
$new_columns = array_slice( $columns, 0, $position, true ) + $phone;
return array_merge( $new_columns, $columns );
}
Updated for WooCommerce 3.
You should use manage_shop_order_posts_custom_column
action and change the column data by checking the column name
switch( $column ) {
case 'shipping_address' :
echo 'sample data';
break;
}