WooCommerce
WooCommerce is my personal favorite eCommerce plugin for WordPress. It is easy to use and it is very popular, making it easy for anyone to find a theme that they like that uses it. One thing that some people don’t like is that by default on the checkout page, if you are creating an account, the phone number field is required. If you are selling digital products, or cheaper merchandise, you might not want to require that field. Sometimes people don’t like to give out their phone number. Follow these instructions to remove the requirement for the phone field.
Option 1
Step 1
The first option is to to purchase the Checkout Field Editor plugin for WooCommerce for $49.95. If you aren’t comfortable adding code to your site, then that is your best option. Otherwise the second option is to add some code to your WordPress functions.php file, which I will show you below.
Step 2
In WordPress go to “Appearance” and click into “Editor.”
Step 3
On the right hand side we will click into the functions.php file. (I highly recommend backing this file up first via FTP just in case. If you make one mistake you could take your site down)
Step 4
We are going to add the following code right before your closing PHP tag.
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; }
See screenshot below with example.
Step 5
Then click on “Update File”.
And now the Phone field is now longer required on checkout.
Option 2
If you don’t like editing code, you could also purchase the WooCommerce Checkout Field Editor extension.
To read more tutorials on customizing the checkout fields, see this tutorial: Customizing checkout fields using actions and filters.
As always feel free to leave your comments below!
Thanks for this! I am using the same code to make our email address field not required – but the basic idea is the same.
Awesome, I should add that to the post as another option :) Definitely can be applied to other fields. Glad it was helpful. Thanks for the comment.
Thanks! This worked perfect for me!
Thank you!! This was very useful.
Thank you for this awesomeness!
We use checkout field editor extension and it works just fine for us, although we could agree that adding just a few lines of code might be a better option because plugins (specially if you have bunch of them installed) slow down the whole site load and increase # of http requests which negatively affect SEO. Anyhow useful tutorial, I am glad I ran into this site!
Thanks for the suggestion. I have added that to the post as another option. I agree I don’t like installing additional plugins to do small jobs, but some people might feel safer doing it that way.
Thank you for this tutorial :D helped me a lot.
Great, glad it was helpful!
hello and thank you for this
i need this code for only use digital products but not work
When our digital product. This field is unnecessary and when the product is essential postal
thank you for everything
Thanks for the snippet. It works perfectly for me.
Thanks, the phone field is no longer required, but it has ‘123456789’ in the field. Can this be removed?
Hello….
would u tell that which key word used for E mail address in checkout field just like “phone” for phone number.
Greit!
Great, Save my many hours. I used this code , working for me, perfect. Thanks.