Hi there,
Im trying to customize the checkout billing fields by adding a VAT field after company field. Tested the code on a different theme and its working but not on XStoretheme. I cant seem to override the fields. Below is the part of code im trying in child theme functions.php (I know how to handle validation and saving).
add_action( 'woocommerce_before_order_notes', 'add_vat_checkout_field' );
function add_vat_checkout_field( $checkout ) {
$current_user = wp_get_current_user();
$saved_vat_no = $current_user->vat_no;
woocommerce_form_field( 'vat_no', array(
'type' => 'text',
'label' => 'VAT Number',
'placeholder' => '12345678',
'required' => true,
'default' => $saved_vat_no,
), $checkout->get_value( 'vat_no' ) );
}