Make phone number not require (5 posts)

  1. serviceweb
    Posted 3 years ago #


    i look this guide http://docs.woothemes.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/ becouse i need to make the phone number not require on my ecommerce but i have a probem. Wich file need to change? I can't find. Thanks


  2. Yojance Rabelo
    Posted 3 years ago #

    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;
  3. jmarshane116
    Posted 2 years ago #

    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!

  4. jmarshane116
    Posted 2 years ago #

    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.

  5. ant999
    Posted 2 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.