How to make Billing field not required with function

Total 8 users online

Most users ever online were 103, on 18 Sep 2021 @ 7:46 am

How to make Billing field not required with function

If you want to make Woocommerce billing or shipping field is not required then you just add below function to the function.php file, custom function file or custom child theme function.php In the below example, we’ll edit the Billing Phone field. Add this code to your child theme’s functions.php file.

STEPS TO CHANGE DEFAULT NOTICE TEXT

  1. Open WordPress admin panel, go to Appearance > Theme Editor 
  2. Open functions.php theme file
  3. Add the following code at the bottom of function.php file
  4. Save the changes and check your website. The custom text in add to cart button should show up now.

add_filter( 'woocommerce_billing_fields', 'wc_unrequire_wc_phone_field');
function wc_unrequire_wc_phone_field( $fields ) {
$fields['billing_phone']['required'] = false;
return $fields;
}

you can replace ” billing_phone ” with your desire field that you want to change

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn
Share on pinterest
Pinterest
Share on reddit
Reddit
Share on skype
Skype
Share on telegram
Telegram
Share on whatsapp
WhatsApp
Share on email
Email
Share on print
Print

Add comment:

Need Help? Chat with me
Please accept our privacy policy first to start a conversation.