I am having a problem adding a custom field on the checkout of WooCommerce, I am using this code:
add_filter('woocommerce_checkout_fields','custom_override_checkout_fields');
function custom_override_checkout_fields($fields) {
$fields['billing']['billing_colonia'] = array(
'label' => __('Colonia', 'woocommerce'),
'placeholder' => _x('', 'placeholder', 'woocommerce'),
'required' => true,
'class' => array('form-row-wide'),
'clear' => true
);
$fields['shipping']['shipping_colonia'] = array(
'label' => __('Colonia', 'woocommerce'),
'placeholder' => _x('', 'placeholder', 'woocommerce'),
'required' => true,
'class' => array('form-row-wide'),
'clear' => true
);
return $fields;
}
It indeed shows the field on the checkout form, but I fill it and I complete an order and nothing about this new field is saved on any order at /wp-admin/edit.php?post_type=shop_order
Should I do something to save that info? What is the correct way to add a custom field there?