Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the mrshafaq domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/tuwqiaec/mrshafaq.com/wp-includes/functions.php on line 6114
How to make Billing field not required with function - Woocommerce - MrShafaQ

How to make Billing field not required with function

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

Subscribe to get latest updates !