I am using "Show hide custom WooCommerce checkout field based on selected payment method" answer to one of my questions, to show / hide a custom checkout billing field, and it works fine.
Question: Is it possible to show my Custom field in WooCommerce orders in the admin panel?
To display "billing_options" custom checkout billing field value in admin order pages on the billing information column, use the following:
add_action( 'woocommerce_admin_order_data_after_billing_address', 'display_billing_options_value_in_admin_order', 10, 1 );
function display_billing_options_value_in_admin_order($order){
if( $value = get_post_meta( $order->get_id(), '_billing_options', true ) )
echo '<p><strong>'.__('Invoice Number', 'woocommerce').':</strong> ' . $value . '</p>';
}
To make this custom checkout billing field appear as editable in backend use the following:
add_filter( 'woocommerce_admin_billing_fields', 'custom_admin_billing_fields', 10, 1 );
function custom_admin_billing_fields( $fields ) {
$fields['options'] = array(
'label' => __('Invoice Number', 'woocommerce'),
'show' => true,
);
return $fields;
}
Code goes in function.php file of your active child theme (or active theme). tested and works.