Adding custom shipping and billing fields in admin panel and emails
-
Hello,
I followed next tutorial https://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ to insert a new field:
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { $fields['billing']['billing_dni'] = array( 'label' => __('NIF-DNI / NIE', 'woocommerce'), 'placeholder' => _x('Documento fiscal para factura', 'placeholder', 'woocommerce'), 'required' => true, 'class' => array('form-row-wide'), 'clear' => true ); return $fields; }
And according with your explanation:
What do we do with the new field? Nothing. Because we defined the field in the checkout_fields array, the field is automatically processed and saved to the order post meta (in this case, _shipping_phone). If you want to add validation rules, see the checkout class where there are additional hooks you can use.
I did nothing else but I can’t see this new field in the order (in admin panel) and neither in the email
What else should I do?
Thank you very much in advance,
Zaida
- The topic ‘Adding custom shipping and billing fields in admin panel and emails’ is closed to new replies.