In Woocommerce, I used Add a new custom checkout field before billing details in Woocommerce? from @LoicTheAztec that works perfectly.
I'm having trouble displaying the information in the admin order page.
Then I tried using Add order metadata to WooCommerce admin order overview, making some changes in the code to match with my needs:
// display the extra data in the order admin panel
function kia_display_order_data_in_admin( $order ){ ?>
<div class="order_data_column">
<h4><?php _e( 'Extra Details' ); ?></h4>
<?php
echo '<p><strong>' . __( 'Some field' ) . ':</strong>' . get_post_meta( $order->id, '_my_field_name', true ) . '</p>';?>
</div>
<?php }
add_action( 'woocommerce_admin_order_data_after_order_details', 'kia_display_order_data_in_admin' );?>
Extra Details and Some field: appears, but the custom field value isn't displayed.
I'm still trying to figure out what I did wrong here. Any suggestions on where I should look?