Для отображения в деталях заказа администратора в виде редактируемых полей
add_filter('woocommerce_admin_billing_fields', 'custom_admin_billing_fields', 10, 1);
function custom_admin_billing_fields($fields) {
$fields['billing_fiscalcode'] = array(
'label' => __('billing_fiscalcode', 'woocommerce'),
'show' => true,
);
$fields['billing_vatcode'] = array(
'label' => __('billing_vatcode', 'woocommerce'),
'show' => true,
);
$fields['billing_recipientcode'] = array(
'label' => __('billing_recipientcode', 'woocommerce'),
'show' => true,
);
$fields['billing_pecaddress'] = array(
'label' => __('billing_pecaddress', 'woocommerce'),
'show' => true,
);
return $fields;
}
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_fiscalcode', true))
echo '<p><strong>' . __('Billing Fiscalcode', 'woocommerce') . ':</strong> ' . $value . '</p>';
if ($value = get_post_meta($order->get_id(), 'billing_vatcode', true))
echo '<p><strong>' . __('billing_vatcode', 'woocommerce') . ':</strong> ' . $value . '</p>';
if ($value = get_post_meta($order->get_id(), 'billing_recipientcode', true))
echo '<p><strong>' . __('billing_recipientcode', 'woocommerce') . ':</strong> ' . $value . '</p>';
if ($value = get_post_meta($order->get_id(), 'billing_pecaddress', true))
echo '<p><strong>' . __('billing_pecaddress', 'woocommerce') . ':</strong> ' . $value . '</p>';
}