This is my function I've created to retrieve any custom billing field I want:
/**
* Returns a custom billing field value
*
* @param object $order
* @param string $custom_field
*
* @return string
*/
function get_custom_billing_field( object $order, string $custom_field ): string {
$order_data = $order->get_data();
$custom_field_val = '';
if ( ! empty( $order_data ) && isset( $order_data['billing'][ $custom_field ] ) ) {
$custom_field_val = $order_data['billing'][ $custom_field ];
}
return apply_filters( 'get_custom_billing_field', $custom_field_val );
}
This is an example call for retrieving the vat_id
set in WooCommerce Germanized Pro:
$order = wc_get_order( 22 );
get_custom_billing_field( $order, 'vat_id' );
I hope this helps someone. If you got a better idea, please let me know.