WooCommerce has the ability to remove the address fields in the checkout form of the billing and shipping forms, this is great if you do not require the address fields as you may have a virtual/download only products that don’t require shipping, less fields to fill out = happy customers.
You can remove address field layouts, so you have just name and email.
Remove Billing Fields
This is all done with the woocommerce_billing_fields filter, so in your themes functions.php you can add the following…
So this will remove or unset all the billing address fields if you want to keep a certain field in just remove the relevant line from the code snippet.
Remove Shipping Fields
If you have products that are linked to shipping, then the additional shipping fields also show, the woocommerce_shipping_fields filter can remove these, you probably want to keep most to ship the item, but might want to remove the shipping_company field for example.
What if you wanted to retain all the fields if the cart products contained shipped products but also wanted a trimmed down field selection if the cart only had virtual products – then you can use the looped carts items to determine if they are virtual only…
16 comments
fares yousry
Thanks a lot! Finally, that’s the right code I am looking for, after much time been searching, searching, and then testing until I found this one, Great job!
Konrad
Many thanks for this article! Worth adding priority in add_filter, e.g.:
add_filter( ‘woocommerce_checkout_fields’ , ‘virtual_products_less_fields’, 9999 );
Wouldn’t work without it for me.
Do It Now Coach Paul Hinkle
I hope I don’t get canceled for saying “You’re the man!”
Chua Yew Beng
Hi,
How to unset the billing address field if the payment method is COD?
Jayesh Purohit
How to hide “BILLING DETAILS” & “ADDITIONAL INFORMATION” in checkout page?
show only “YOUR ORDER”
Soulshake
Yeeeah! Thank you so much!! This works even with variations (same product with a virtual/downloadable variation and a shipped one)! It is the only one on the whole web working with this setup!
This should be default in WC, THANK YOU SO MUCH!!
Alan Woollard
Hi
This looks almost what I’m looking for.
To be perfect for me I want to be able for customers to select “Pick up” or Delivery and based on that
either not show address fields for pick up (Or at least have them optional.
or require them for delivery option
Maarja
Hi,
The code is awesome – i could remove the unwanted fields, but now i have the problem that i cannot finish the checkout because the program asks me to fill in the required fields, which i removed from the page.
Thank You in advance!
Jose
Thanks, It worked perfectly for me!
Alvina
Thank you for sharing this tutorial. Can you please tell me why the checkout stop working after removing last name and middle name fields? Here is the code that I have seen https://www.cloudways.com/blog/how-to-edit-delete-fields-and-email-in-woocommerce-custom-checkout-fields/.I have almost implemented the same just change the fields name that I don’t want to showbut the checkout not working as the fields removed. Is there any other way to do this?
function remove_additional_information_checkout($fields){
unset( $fields[“billing_first_name”] );
unset( $fields[“billing_middle_name”] );
return $fields;
}
add_filter( ‘woocommerce_billing_fields’, ‘remove_additional_information_checkout’ );
hardik thakkar
How can I do the opposite? When typing the address for some countries like Singapore, WooCommerce by default hides delivery suburb and state fields. Is there a way I can force those fields to be always visible?
SuziQue
Is there a way to select for each product where or not an address is needed.
I have both physical and digital products. I only need the address if they are ordering physical products.
Neil Gowran
Good question – have added a snippet in the post.
Patryk
Is there possibility to set fields dependently on user role?
In. example I have basic user and merchendiser
For basic user I don’t need address, only name and email for payment
but for Merchendiser I need those additional fields like: name of company, address of store etc.
Melker Walter
Great post, I always prefer coding than using a plugin for customizing woocommerce checkout page. I did also customize my checkout by changing the texts where I made a post here: http://www.22bulbjungle.com/woocommerce-change-text-on-checkout-page-quick-tutorial/
Great write-up by the way!
miguras
Hello. Great article. I made a plugin that do the same. You can disable/rearrange content inside the single product page and shop page. Also, you can remove checkout fields. I uploaded it to wordpress, so here you have the link WooEnhacer – WooCommerce Customizer if someone is interested.