How to make Billing field not required with function

Total 6 users online

Most users ever online were 338, on 17 Aug 2022 @ 2:17 pm

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

Facebook
Twitter
LinkedIn
Pinterest
Reddit
Skype
Telegram
WhatsApp
Email
Print

Add comment:

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