Support » Plugin: WooCommerce » Make phone number not require

Viewing 4 replies - 1 through 4 (of 4 total)
  • The very last piece of code on that page is what you need to insert into your functions.php file inside your WordPress theme.

    add_filter( 'woocommerce_billing_fields', 'wc_npr_filter_phone', 10, 1 );
    
    function wc_npr_filter_phone( $address_fields ) {
    	$address_fields['billing_phone']['required'] = false;
    	return $address_fields;
    }

    Thanks a bunch for the “how to…” Yojance! I’ve been trying for weeks to make “Phone” not required…I can’t find code for it anywhere, and I’ve gone thru just about every template! This really helped, thanks a millilon!

    OOPs! I think I spoke to soon Yojance! The first time I put the code in, and refreshed the screen, it appeared to work perfectly. But then when I closed the site and tried to re-open it, it crashed and gave me an Internal 500 error…or something to that effect…and I’m not sure why, so ultimately I had to remove the code…hmmm!

    Anyone have any suggestions on why this happened? I’m researching, and if I find anything, I’ll post.

    Adding the code above worked for me. The phone number is no longer compulsory at checkout. I added it to the bottom of my functions.php file. The internal 500 error sounds like you had a problem with your htaccess file.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Make phone number not require’ is closed to new replies.