If you are using WooCommerce for digital products then you obviously do not need all of the checkout fields (billing details) that are on the checkout page by default.
Seeing as multiple people have contacted me to fix their websites after following various guides on “How to remove the WooCommerce checkout fields”, I have decided to write a post on how to safely but very easily do this.
The thing is, all of these guides advise you to directly modify your functions.php file which I am highly against.
If you are not familiar with coding and you cluelessly follow their instructions there is a high chance that you will break your website.
Don’t believe me? Take a look at the user comments from these guides, I guarantee that there is at least one person that is upset because their website broke.
Below I’m going to show you the safest and quickest way to remove the checkout fields from WooCommerce and if you do make a mistake you can very easily undo the changes, unlike if you were to modify functions.php directly.
WooCommerce: How To Safely Remove The Checkout Fields
-
- 1. To remove the billing fields in the WooCommerce checkout page first install the plugin My Custom Functions.
This plugin allows you to easily and safely add functions, snippets or any custom code without directly editing your functions.php file.
The code entered in the plugin will run safely and will not generate any fatal errors, this means your website will not break if there is an error in your code.
Also, the custom code you add into the plugin will continue working, no matter how many times you update or switch your theme.
-
- 2. Once you have installed the plugin go to Appearances and then click on Custom Functions.
You will see a white text area where you can enter code.
-
- 3. To remove all of the checkout fields from WooCommerce, copy and paste the below code into the Custom Functions plugin.
/* WooCommerce: The Code Below Removes Checkout Fields */
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
unset($fields['billing']['billing_address_1']);
unset($fields['billing']['billing_address_2']);
unset($fields['billing']['billing_city']);
unset($fields['billing']['billing_postcode']);
unset($fields['billing']['billing_country']);
unset($fields['billing']['billing_state']);
unset($fields['billing']['billing_phone']);
unset($fields['order']['order_comments']);
unset($fields['billing']['billing_email']);
unset($fields['account']['account_username']);
unset($fields['account']['account_password']);
unset($fields['account']['account_password-2']);
return $fields;
}
- 4. If you take a look at the code, you will notice that it is fairly easy to understand which checkout field each line represents
For example, the below code hides the fields:
– First Name
– Last Name
– Company
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
If you would like to display any checkout fields that have been removed, you can simply delete the line of code that represents the specific field.
That’s all there is to it! Simple, Fast and Safe!
If you encounter any errors you can simply remove the code from the Custom Functions plugin and your site will go back to how it was.
An amazing WordPress plugin to quickly and easily create beautiful, engaging and visually impressive landing pages that convert visitors into sales!
Disclosure: This page contains affiliate links. I have a strict policy to only promote products I personally use to run my business. If you decide to purchase a product through an affiliate link I will receive a commission at no extra cost to you. This is how I fund the blog – thanks for your support!
How To Remove The Additional Information Tab
You may be wondering how to remove the Additional Information tab on the single product page.
You can easily remove it by adding the below code into the Custom Functions plugin (underneath your existing code).
/* WooCommerce: The Code Below Removes The Additional Information Tab */
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['additional_information'] );
return $tabs;
}
/* WooCommerce: The Code Below Removes The Additional Information Title Text */
add_filter('woocommerce_enable_order_notes_field', '__return_false');
How To Change Billing Details Text
If you want to change the “Billing details” text at the top of the checkout page you can use the below code which will change the text to “Shipping Details”.
/* WooCommerce: Change Billing details text to Shipping Details */
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing details' :
$translated_text = __( 'Shipping Details', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
To change the “Shipping Details” text to something else simply change the below line in the code.
$translated_text = __( 'Shipping Details', 'woocommerce' );
What did you think of this guide? Did you manage to safely remove the checkout fields from WooCommerce?
You may also be interested in…
Thrive Leads – The Best Popup Plugin for WordPress
If you are looking for the best WordPress popup plugin that allows you to create various types of opt-in forms to collect emails and quickly grow your mailing list then I cannot recommend Thrive Leads enough. Every opt-in form on my website has been created using Thrive Leads.
How to change name add to order?
Good blog post. I definitely appreciate this website.
Stick with it!
It worked, it actually prevented the checkout fields from displaying, however when I place the order the system ask me to input a valid address which I can’t since the field is not there (which it is what I wanted but…). So it hides the fields but not really working to place the order.
Any solutions?
P.S. Code was placed as is.
Hey Cesar, it might be your theme but make sure your settings under the General tab are like this:
great its working thank you Sir
thanks for this. everything works but when i try to check out, it says i should enter account password. Please help
i need registration for the first time and hide billing if same person login and purchase something
how to set and hide billing details
Works great on a Multi-site network I’m developing and will use it on a digital download site as well, Just wondered if it’s possible to remove the labels “Your order” and
“Checkout for Shop – ……. “
Hi
I could hide “Additional Information” but the ” Billing Details” is still coming up. How do I hide that ??
Hello, First of all really thank you fir providing this plugin. I used this plugin to remove postal code / zip code in my website and it helped me with unset($fields[‘billing’][‘billing_postcode’]);
but there is one more option of “Ship to a different address?” can you please tell me how to remove post code from here if my customer is willing to ship on different address but I don’t want my customer to enter post code in ship to different address as well. Thank You.
Thanks a lot for the simple solution. This is the only one that actually worked! 😀
My pleasure 🙂 Thanks for the feedback.
Hi there,
Firstly thanks for the plugin and explanation,
I have issue with last version of wocomerce still geting this error: ” Please enter an address to continue. Invalid payment method. “
Yep, I have the same issue
Are you both removing all the fields for a “digital” product?
The site crashed and I get this message:
Service Unavailable:
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later. Additionally, a 503 Service Unavailable error was encountered while trying to use an ErrorDocument to handle the request.
I followed the instructions like the video, I have removed the code, last installed plugins, everything that may cause conflict, and the entire site disappeared, I cannot fix it and I have lost the job. If you have any advice to correct please send, thank you very much.
There was probably an issue in your code since it’s working for everyone else.
To stop the code inside the plugin from working while you fix it you can follow these instructions on the plugin page.
thank you
Great share thanks work for me.
Great to hear! 🙂
Thank you so much! Very clear and easy steps to follow!
Thanks for the feedback 🙂 Glad it was helpful.
Oh Great! Straight to the point. It worked fine. Thanks!
Great to hear! 🙂
This worked perfectly. Thank you so much!
My pleasure 🙂
I have enabled first name last name adress and phone number fields when i submit it is showing me Please enter an address to continue.
Copied the code exactly as you have it, and placed into the site.
The site crashed and I get this message:
The site is experiencing technical difficulties. Please check your site admin email inbox for instructions.
No email sent, and cannot get back into the site at all. Usually I can access through an incognito window but still same error.
How would I get back into the site and remove the code.
Thanks
Did you copy the code exactly as I have it or did you make some edits?
It should work since it’s worked for me and everyone else…
In order to get the site back you can take a look at the instructions on the plugin site:
https://wordpress.org/support/topic/instruction-error/
Hi Peter
crashed my site unfortunately ,
got this error code – removed plugin and site came back up
any ideas what caused this
I use learndash 3.0
Cheers
Did you add the code 100% exactly the same (copy and paste) or did you modify a bit of it?
Double check the code that i shared in the post.
It is different to what you have pasted, you missed a line.
Hi Peter
Great video 🙂
I am having trouble getting rid of the state field in the customer address page. The state field does not show up in the checkout page, and i want that to be the same for the customer addresses page. Just to be clear, it is the state field when the customer goes to his account page -> addressses, and wants to add or change billing address and shipping address, I want the state field to go away.
Thanks
Hello i would like to rename billing details to delivery details on checkout page how can i do that? also i would like to remove registration on woocommerce is there a code for that to add in the php inserter plugin
How do i remove the “Billing details” title?
For some reason, this is not working for me. For one, I don’t get a “Customs Functions” menu item under the ‘Appearance’ link; the only way I was able to access the area to add code was by clicking ‘settings’ under the plugin. And then when I do add the code as instructed, nothing happens on my woocommerce checkout page. Any thoughts?
It is now called PHP Inserted under settings.
Don’t forget to turn the plugin on, it’s off by default.
Thanks for replying Peter.
Okay, I saw “PHP inserter” under settings as advised. And yes, that takes me to the same screen as accessing it through ‘settings’ under the plugin. But inserting the code (and making sure the plugin is turned on) still doesn’t work for me. ? I wonder if some other plugin is causing a conflict. ?
Not sure what’s wrong exactly…
It has been working for everyone else so there must be something wrong on your end.
I suspect so too. Ugh! Just my luck! ?
FINALLY FIGURED IT OUT!!! ???
So, I initially had to go into my plugin file to “STOP” the plugin because I was getting errors. However, although I fixed the errors part then and I had the “ON/OFF” buttons when I try to make changes, the plugin was still in “STOP” state in the backend. I renamed the file to “START” and bingo, everything works fine!
Thanks so much for making this available and for your patience! ??
Thank you!
No problem! 🙂
Thank you so much, your video link on YouTube and this blog article are brilliant. Works like a charm and perfect instructions without garble
No problem! Great to hear this blog post has helped you 🙂
Hi Peter
Can you reorder the fields with this?
Cheers
Rob
Hey Robert,
This tutorial is only how to completely remove the checkout fields.
You can try add the below code into the plugin I recommended in this turtle and see if it works (I haven’t tested it)
add_filter("woocommerce_checkout_fields", "order_fields"); function order_fields($fields) { $order = array( "billing_first_name", "billing_last_name", "billing_company", "billing_address_1", "billing_address_2", "billing_postcode", "billing_country", "billing_email", "billing_phone" ); foreach($order as $field) { $ordered_fields[$field] = $fields["billing"][$field]; } $fields["billing"] = $ordered_fields; return $fields; }
Thank you so much Peter! You saved me $USD 50!
My pleasure Lauren! 🙂
Just wanted to thank you for this, it’s awesome!
Thanks for your feedback Patricio.
Great article!
But how can i achieve that:
– hide/unset one checkout_field, when customer chose some gateway (in my case payPal pro).
I try many tutorials , but any works!
Thank you
Great help!!!!Thanks a lot!
Greetings from Thessaloniki!
Maria
My pleasure Maria! 🙂
Hi there, this worked wonderfully, thanks so much! The only thing is the actual boxes titled “Billing Details” and “Ship to a Different Address?” are still displayed, though the address fields are now hidden. Any chance you know how to get those boxes to disappear, too? Thank you!
Glad to see it worked for you Jenn.
To remove Ship to a different address you can do within WooCommerce
Woocommerce > Settings > Shipping – there’s a checkbox to force shipping to billing address only.
With the billing details, I’m not sure at the top of my head, check the comments I think someone else may have asked the same question.
Sorry, I wasn’t clear in my reply – “Ship to a different address” has now been removed. What remains is the “Billing & Shipping” box and the “Additional Information” box – both empty. Do you know of any way to remove those? Thanks so much.
Hello Peter!
This is (almost) exactly what I’ve been looking for!
The only problem I’m having is if someone also adds a physical product to their cart, there are no fields to submit their order.
I was hoping the fields would disappear only if it was a free/digital item.
Is this possible?
Thanks SO much!
Sharon
Hey Sharon,
It is possible but unfortunately what you are looking for is a custom solution and outside the scope of this tutorial.
If this is something you are willing to pay for please use this form and I will provide a quote.
That was lightning fast, Peter! Thank you!
I just requested a quote and look forward to hearing from you.
Thanks again!
Sharon
Hello Peter,
Thank you so much for this post. It worked like a charm.
I do still have a field that I want to remove. Maybe its part of my theme but the field Suffix after nr* is not needed in my country.
But I dont see that field in the piece of coding that you provide. I tried removing it by adding the code billing_suffix or shipping_suffix but that does not remove the field.
Could you please help me? Thank you in advance
I’m glad it worked well for you Nadine 🙂
What is NR exactly? is it street number?
Hi Peter,
This is my check out: https://allthatglitter.nl/checkout/
It’s already translated to Dutch. The fields on the second row say [straat*] and then [Nr*] and the last one says [Suffix]
I really want to remove the last one, the Suffix one. Do you maybe know the coding for that?
I’ve never seen that before… Try add the below to the code into the plugin.
unset($fields['billing']['billing_house_number_suffix']);
Otherwise you can add this to your CSS:
#billing_house_number_suffix_field { display:none !important; }
or
.billing_house_number_suffix_field { display:none !important; }
Hi Peter,
The first option worked perfect 🙂 thank you very much for your help and time!
I want to delete the company field from the different address. how can I do ?
Amzad,
Do you mean to ask, “remove the company field from the Ship to a different address section?”
I think it’s:
/* WooCommerce: The Code Below Removes Checkout Fields */
add_filter( ‘woocommerce_checkout_fields’ , ‘custom_override_checkout_fields’ );
function custom_override_checkout_fields( $fields ) {
unset($fields[‘shipping’][‘shipping_company’]);
return $fields;
}
Hi,
Can you tell me how to remove or hide the billing address info from the Woocommerce completed order email?
Thanks
Heya Lee,
What you want to do is completely different to what this post is about…
Try this link.
Thank you
I want to remove inscription in cart “Availability: In Stock”
I found in wp-content\themes\theme-name\woocommers\single-product\meta.php code which is responsible for the output of this inscription.
How to disable this?
Hey Ann,
You can just do in the settings.
WooCommerce > Settings > Inventory (Products > Inventory).
Peter,
Do you have any suggestions on how to pre-populate default information in the Billing Fields of the Check Out Page? I also included the code we used in the functions.php of our child theme, to remove specific fields (like first_name and last_name, etc.) from the billing section of the checkout page.
/** * @snippet WooCommerce Set Defaults @ Checkout * @tested with WooCommerce 3.0 */ function test_set_checkout_field_input_value_default($fields) { $fields['billing']['billing_company']['default'] = 'ABC Companies'; $fields['billing']['billing_address_1']['default'] = '112 Minnehaha Ave'; $fields['billing']['billing_city']['default'] = 'Chicago'; $fields['billing']['billing_state']['default'] = 'IL'; $fields['billing']['billing_postcode']['default'] = '61223'; $fields['billing']['billing_phone']['default'] = '555-288-0782'; $fields['billing']['billing_email']['default'] = 'myemail.com'; return $fields; } add_filter( 'woocommerce_checkout_fields', 'test_set_checkout_field_input_value_default' ); /** * @snippet WooCommerce Remove Felds @ Checkout * @tested with WooCommerce 3.0 */ add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { unset($fields['billing']['billing_first_name']); unset($fields['billing']['billing_last_name']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_country']); return $fields; }
Heya Javier,
Unfortunately what you want to do is a custom job and I would need to spend some time investigating into it. I can provide you a quote if you are interested (please email me)
However, from the top of my head, you can try this:
Hopefully it works for you…
<?php add_filter( 'woocommerce_checkout_fields' , 'default_values_checkout_fields' ); function default_values_checkout_fields( $fields ) { // You can use this for postcode, address, company, first name, last name and such. $fields['billing']['billing_city']['default'] = 'SomeCity'; $fields['shipping']['shipping_city']['default'] = 'SomeCity'; return $fields; } ?>
I have enabled first name last name adress and phone number fields when i submit it is showing me Please enter address invalid payment error
Hi Zahid,
Do you have your payment gateway setup?
If so, can you try copy the code exactly how I have it and then test to see if you still get that error?
No its just a cash on delivery
Sorry I am not quite sure how you have setup your WooCommerce.
The code I provided works and proof of that can be seen in the comments section.
I’m assuming it’s something to do with the way you setup payments, if you set only cash on delivery then why is there a payment error if no payment is required…
This has removed the fields on the checkout page which is so great. However, when I try to check out it sill asks me to enter a valid address. Any ideas.
Cree
Hey Cree,
Can you please try copy the code exactly how I’ve written it and do a test before you customise it how you want it?
If it’s still causing an error then it may be something to do with your theme, you will need to search how to remove validation from checkout field.
Is there a way to make it so woocomerce only asks for billing details for certain payment methods?
Customers don’t like submitting billing details, that’s why paypal is so popular.
I deal digital goods, and want to turn it off for g2apay
You can remove billing details completely and only allow PayPal?
With a PayPal Premier or Business account you can accept credit card payments.
I haven’t look into your problem in detail but surely there is a way… You can also try the plugin Easy Digital Downloads which may do what you need it to do.
Sorry I thought I was replying to something else. sorry
I already have all my products made in woocomerce, so switching would put me back months
I can’t use paypal
I use g2apay which has all customer data on their side, so i have no need to caputre it
I am not familiar with g2apay but you may want to contact their support team or search Google for an “Express Checkout” plugin that works with g2apay so that users do not need to input their customer details.
Hi,
No matter what method or plug in I use, the field “City” comes back!!!
Ben.
Heya Ben,
Can you please confirm that the “billing” details come back when you follow the above steps?
Does it get removed at all when you copy and paste the entire code in the plugin I provided?
Hello Peter,
I didint work for me. I need you help. I just want to see the following on my checkout page
Account URL
First Name
Last Name
Email
Phone Number
Hey Ron,
Can you try copy the entire code into the plugin I provided above.
Please copy and paste it from top to bottom.
hi
thanks for you for this awesome plugin and the great video
i want to ask you
– how i change fields from the require to not require
– how i change fields name
thank you!
No problem!
To make the fields not required use the below code and just edit it.
//make billing fields not required in checkout 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; }
Changing field name…. that’s a little more technical… You can get a plugin to do that or use this guide:
Hey Peter,
If you send to another adress what will be the code to get rid of some of the fields ?
Thank you !
Hey Danny,
Sorry I’m not sure what field you are talking about exactly?
Did you try the code I have provided to see if it removes it by any chance?
Hey Peter yes i try and it works in the billing detailsabove, only when i choose send to another adress ik will be standard so i can’t remove company ect
further very nice work !
Hello sir,
I am new in wordpress. I am building a eCommerce WordPress site. My question is How can i turn on required field on for phone fields?
Thanks,
Hello Imam,
I believe the phone field is required by default so you don’t need to do anything.
Please test it and let me know if I’m incorrect.
You’re awesome man. Thanks. A simple and effective tutorial that worked 🙂
Thanks heaps Andrew 🙂 appreciate it!
Hey this did not work for me, I’ve tried many different plugins and now im left with 3 fields of country and unable to remove fields.
I’m using Kallyas theme.
hey Jakob,
Which fields are you left with exactly? Country and what other once?
Did my code remove any fields for you at all?
Hey mate I got it to work, thank you.
Awesome! Glad you got it to work 🙂
Great Tutorial
But i see there is no function for suburbs.
I need to get rid of this field.
Please can you assist
Thanks Vaughn!
Try include the below for suburb
$fields[‘billing’][‘billing_city’][‘placeholder’] = ‘Suburb’; $fields[‘billing’][‘billing_city’][‘label’] = ‘Suburb’;
Please how do i make the state textbox give a pull down so i can choose out of the list, because mine is not giving me a pull down.
Your theme to to blame, but you can switch off those ‘chosen’ select boxes in woocommerce settings (to make them plain select boxes).
how can I change the textbox field to combobox?
Hi,
Thanks so much for the article, and for introducing me to the My Custom Functions plugin. It’s brilliant. I spent ages hunting for a way to remove the company name from the checkout before finding your youtube video.
One additional thing I haven’t managed, though. How to stop the “Please select your State” from auto-populating in the address info… So if customers don’t provide a county when they create an address, it defaults to show “Please select your State” instead of “Select your county”, or being blank.
Any advice on this?!
Thanks,
K
I’m glad my blog post was helpful to you Kate 🙂
I can’t quite understand your second issue, can you please post a link to your website so I can take a quick look?
Hey! This plugin completely destroyed my woocommerce shop.There’s nothing I can do. I can’t even access my plugins area anymore.I am getting an error message:Fatal error. Can you please advise how to get my website back.I have made a terrible mistake by getting this plugin in the frst place.
Hey Shell,
This is a very common issue with WordPress and it usually occurs when WordPress is not using it’s full memory.
Here is how to increase the memory and everything should work after that.
https://youtu.be/CB0BfoDyVN4
If this does not work you can simply go into the WordPress folder and remove the plugin via FTP or File Manager.
If you need more help please feel free to email me.
Hi Peter.Thank you for a very fast reply. Unfortunately that did not work and caused a syntax error and I could not sign in to my dashboard. I have now deleted the plugin through FTP. Thanks for the advice. Shame it didn’t work on my site, thanks for all the help.
No problem!
That is very strange, this is the first time I’ve heard of the plugin doing that, maybe it’s not compatible with your Theme or something…
If you still need to remove the checkout fields please be careful not to add code directly into your functions.php file like other websites advise.
At least use a child theme or try another functions plugins.
There is a possibility that it could break your website and then it will be difficult for you to fix.
Or at least take a backup of your site before doing it.
Hi
Current under order notes – there is some helpful text ‘ Notes about your order, e.g. special notes for delivery.
I would like to update this meta note to ‘Notes about your order, e.g. Name to be printed on duty manager slide’
What is the code I use?
Hey Steph 🙂
Try this:
add_filter( 'woocommerce_checkout_fields', 'webendev_woocommerce_checkout_fields' ); function webendev_woocommerce_checkout_fields( $fields ) { $fields['order']['order_comments']['placeholder'] = 'Your custom text here'; return $fields; }
Hello There,
I really liked the post, especially the video which was very helpful. However i was unable to remove “Billing Details” and “Additional Information” text on the checkout page. I even tried the second code for removing the “Additional Information”, but it didn’t help. Any ideas how to delete this text?
Hey Jack,
Can you please try install the Custom Functions plugin and copying and paste the whole code I provided to see if it removes anything?
Please remember to hard-refresh your browser by pressing CTRL+R at the same time.
I have installed the plugin and successfully removed the fields, however at the top of the page “Billing Details” and “Additional Information” those two texts still appear. So i thought you might help me to remove it as well.
Unfortunately that is not part of this tutorial and will require additional work.
For the “additional information” text you can try add this code in the Custom Functions plugin.
add_filter('woocommerce_enable_order_notes_field', '__return_false');
If you like, you can hire me to remove both for you.
Hi,
I tried this code, but it did not work for me. its strange? I’m wondering why it didn’t work?
Please suggest something so I can edit.
Thanks.
Can you please try copying and pasting the whole code to see if it removes anything?
It has worked for everyone so it should work for you too.
hi
how can i validate first name and last name in checkout fields in woocommerce that only takes alphabetic letters…
like (A-Z).
Unfortunately your question is unrelated to the blog post and requires different coding.
Feel free to submit your requirements here – https://blog.peterstavrou.com/product/wordpress-modifications
Hi ,
is there a way to put further condition on this
like i want to show only first name last name email and phone no fields of billing details when only local pick up option is selected. Can you help me with the code editing i did this which din’t work out for me. Please help.
add_filter( 'woocommerce_checkout_fields' , 'woo_remove_billing_checkout_fields' ); function woo_remove_billing_checkout_fields( $fields ) { if( isset(local_pickup == true ) { unset($fields['billing']['billing_company']); unset($fields['billing']['billing_address_1']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_city']); unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_country']); unset($fields['billing']['billing_state']); unset($fields['billing']['billing_phone']); unset($fields['order']['order_comments']); unset($fields['billing']['billing_address_2']); unset($fields['billing']['billing_postcode']); unset($fields['billing']['billing_company']); unset($fields['billing']['billing_city']); } return $fields; }
This may be what you’re looking for?
http://prntscr.com/czi2xk
hi ,
Thank you for the revert i have already disabled the shipping address for store pick up i want to make changes in billing address checkout field.
Thank you so much for this tutorial. I was freaking out when other articles were talking geek-speak about going into the functions.php file etc. Your solution was absolutely wonderful and so much easier for a person with no coding background. The only thing I need to do now is remove the ‘Additional Information’ heading from the check-out page. Can you help me on that issue?
Thanks for the great feedback Patricia.
Please try add this code below your existing code in the Custom Functions plugin.
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 ); function woo_remove_product_tabs( $tabs ) { unset( $tabs['additional_information'] ); return $tabs; }
Thank you for this very clear tutorial for us non-geeks.
But clarify how to remove the pesky “Additional Information” header.
Even after putting up this code, it simply refuses to go (see https://www.alignacademy.com/checkout/)
Where exactly do we put the code? Just under the last closing bracket in the existing code in the Custom Functions tab?
Thank you for your help
Many thanks Winston!
There are two ways you can remove it.
1. By using CSS – You can add this to your style.css file or to your Custom CSS section of your theme:
li.additional_information_tab { display: none !important; }
2. By adding the below code below/above the code you added in the Custom Functions to remove the other fields.
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 ); function woo_remove_product_tabs( $tabs ) { unset( $tabs['additional_information'] ); return $tabs; }
Thanks, but it’s giving a “Fatal Error” message
Please show a screenshot of how all the codes will look when added together
Thank you
Please try the CSS method.
You can go to Appearance, Editor and then make sure style.css is selected.
Just scroll to the bottom of the page and enter the code I provided below then press save.
Thanks Peter.
It still insists on not going away
Here is a screenshot of the code I inserted http://prnt.sc/d3g1sz
Please what am I missing?
Hmm strange… How about if you disable shipping?
http://prntscr.com/d3m6pt
Otherwise try add the below CSS? This should work for your site.
.woocommerce .col2-set .col-2, .woocommerce-page .col2-set .col-2 { display: none !important; }
Thank you Peter.
Free at last!
The last code you posted did the trick:
.woocommerce .col2-set .col-2, .woocommerce-page .col2-set .col-2 {
display: none !important;
}
You’re a great guy.
Thank you
Awesome!
Thanks a lot for the compliment Winston 🙂
Can you explain me in detail. After removing the phone field, I see an error ” This field may not be blank.”
Can you please advise what field you removed and what field you are getting the error message ”This field may not be blank.”?
It might be different fields?
Sorry for the late reply. I removed the phone field by:
unset($fields[‘billing’][‘billing_phone’]);
The phone field got removed from the checkout page, but after clicking submit there is an error message ” This field may not be blank.” I can not proceed further for checkout
Did you add the below?
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { unset($fields['billing']['billing_phone']); return $fields; }
If that didn’t work then you can add the below to make the phone field not compulsory:
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; }
I added :
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;
}
Now the the star for compulsory field for is gone from the phone field. But on clicking sign up now , it gives following error:
This field may not be blank.
It seems that your WooCommerce installation may be different as it works flawlessly for everyone else.
Also you mentioned that the error occurs when “clicking sign up now” button? However, WooCommerce does not have a sign up now button, it has a Buy Now button so I’m not really sure how you have setup WooCommerce and if you are even using it.
I could look into the issue and give your website a custom solution but it’s not something I can do for free.
If it’s something you would like though please visit the below link:
https://blog.peterstavrou.com/product/wordpress-modifications
Great plugin Peter. I am glad that I found your site. Thanks very much
Zayn
Thanks for the great feedback Zayn.
I really appreciate it! 🙂
Hi,
I exactly did it the way you describet it. But know the only thing what I’m getting is a white page…Can you help me resetting it?
Hey Felix,
There must be an error in the code somewhere.
Please try copy and paste it again.
If you can’t access your website because of white screen, use FTP or your cPanel and go to the plugins folder:
wp-content/plugins/my-custom-functions
The open the file my-custom-functions.php and search for:
MCFunctions_exec();
Simply replace that with //MCFunctions_exec();
Then you should be able to access your website and remove the code you added and try again if you like.
Once the code has been modified go into the file my-custom-functions.php and then remove // which you added.
If you need help please email me and I will be more than happy to help you out.
Absolute legend! We only sell stock video footage (digital downloads) so of course most of the fields are totally pointless for our websites’ needs (like shipping address etc). This fix worked perfectly. Thank you so much for taking the time to share this information.
I’m happy that my post has helped you 🙂
When I try to add it in to custom functions it says
“Sorry, but your code causes a “Fatal error”, so it is not applied!
Please, check the code and try again.”
Do you think this is coming from a conflict with another plugin?
Hey Tony,
Sorry that was my mistake, I did some updates to my website last night and it seems that I forgot re-activate my code plugin…
Can you please try copy and paste the code from the page now and advise if you are still having any issues?
It worked. Thank you.
Great to hear!
Thanks for the feedback 🙂
NIce Post ! Solved my problem without spending a dime !
It’s always better if it’s free 😉
Hi
Great Job. Thank you.
how to remove on same page
Create an account?
Ship to a different address?
Thanks Astifa,
You can remove both of those items within the WooCommerce options:
To remove Create an account:
Woocommerce > Settings > Accounts – uncheck Enable registration on the “Checkout” page
To Ship to a different address go to:
Woocommerce > Settings > Shipping – there’s a checkbox to force shipping to billing address only.
thanks peter, helps me a lot
No problem! Thank you for leaving a comment.
Appreciate it! 🙂
Great tutorial for newbies like me, many thanks!
Thank you so effin much!!!
Thanks Max!
It makes me really happy to know that my blog is helping people out 🙂
Peter great article, you wont believe how much I have been cracking my head trying to get this done and
with your article I got it right the first time. Thank you again for sharing, most people would charge a lot
of money for such information.
Thanks Musa, I really appreciate your comment.
This was great!
I was just about to spend $49 but felt it was a waste of money. I tried using similar code directly in my functions.php child theme but it crash my site 3 times in a row. This was extremely easy follow and it worked on the first try. Site up and running with this method! 🙂
Will definitely visit this site more often.
Best Regards
Sven
Thanks Sven!
Glad it was very helpful 🙂
thank you sir!
Very helpful. You rock. Thank you.
Hi Peter,
This works great for the checkout, but what if you want to remove fields from the my-account > edit address section? Any idea how to get remove these fields? Here is an attempt to remove the last name in that area:
// Hook in
add_filter( ‘woocommerce_default_address_fields’ , ‘custom_override_default_address_fields’ );
// Our hooked in function – $address_fields is passed via the filter!
function custom_override_default_address_fields( $address_fields ) {
unset($address_fields[‘last_name’]);
return $address_fields;
}
Unfortunately I don’t use that page so I’m unable to check but give this a try:
add_filter( 'woocommerce_save_account_details_required_fields', 'wc_remove_required_last_name' ); function wc_remove_required_last_name( $fields ) { unset( $fields['account_last_name'] ); return $fields; }
*fingers crossed* 🙂
Ummm that did not work neither. How do you find the section you want to remove though?
What are you trying to remove exactly?
The script above works 100% to remove the checkout fields.
Thank you!
I used to have address, phone etc missed out, but somehow they got put in again. I was worried that I would be putting customers off.
I tried to change it, but I broke my site.
However, your bit of code has solved my problem.
Great to hear that it solved your problem Kirsty 🙂
Nice article, I like this hack but, what if you want different options for different products? Also what if you want to include some fields but not make them a required entry – so optional. I don’t understand why this flexibility is not built in to WooCommerce.