/**
* Add new "Country" column to orders list
*/
add_filter( 'manage_edit-shop_order_columns', 'add_order_column_country', PHP_INT_MAX );
function add_order_column_country( $columns ) {
$columns['country'] = 'Country';
return $columns;
}
/**
* Output "Country" column
*/
add_action( 'manage_shop_order_posts_custom_column', 'render_order_column_country', PHP_INT_MAX );
function render_order_column_country( $column ) {
if ( 'country' != $column ) {
return;
}
$order = wc_get_order( get_the_ID() );
$country_code = $order->get_billing_country();
echo $country_code;
}
No comments yet.