WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Make phone number not require (5 posts)

  1. serviceweb
    Member
    Posted 1 year ago #

    Hello,

    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

    http://wordpress.org/extend/plugins/woocommerce/

  2. Yojance
    Member
    Posted 1 year 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
    Member
    Posted 5 months 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
    Member
    Posted 5 months 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
    Member
    Posted 3 months 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

About this Topic

Tags

No tags yet.