This topic has 4 replies, 3 voices, and was last updated 8 months ago ago by Andrew Mitchell
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' ) );
}
Hi @Riaan,
The code is working fine at our local sites: https://prnt.sc/0-RU89i29tob
Could you please provide temporary wp-admin access?
To grant WP-Admin access, please proceed to create a new user account with an administrator role through your WordPress Dashboard. Once the account is established, you may securely transmit the username and password to us via the Private Content section designated for this purpose.
Thank you for your cooperation and we look forward to hearing from you soon.
Best Regards,
8Theme’s Team
Thanks, I have figured it out. Its working now.
Dear Riaan,
We hope you’re reveling in the experience our theme brings! Your enthusiasm is what fuels our passion. Would you be so kind as to channel that energy into a 5-star rating on ThemeForest? Your feedback is the spark that lights our way!
Click here to spread the love: https://themeforest.net/downloads
Thank you for being an integral part of our journey!
Best Regards,
The 8Theme Team
The issue related to '‘Add VAT field to checkout billing fields’' has been successfully resolved, and the topic is now closed for further responses