If you have been using WooCommerce for a while, you know it is a great e-commerce solution, with incredibly useful set of features. One of the most sort after customization of WooCommerce store, is to remove billing details. Whilst there are a dozens available options in form of plugins, I would like to share in this post how you can get this done using a code snippet.
WooCommerce Billing Details Checkout
WooCommerce adds a form for the client to enter their billing details by default. However, in some cases, you might want to remove a section of the billing details for some products.
In this brief tutorial, I am going to share with you a simple way to remove billing details from WooCommerce. These details include:
- Name
- Company
- Address
- City
- Postcode
- State
- Phone
- Country
You might not need all of them, especially if you only sell digital or virtual products. This will create a smooth transition in the checkout page when users will just insert a few details in the simplest way possible.
Remove Billing details WooCommerce
However, there are no settings in WooCommerce to disable these fields. You can do this using a premium plugin like WooCommerce Checkout Field Editor that is priced at $49 as well as other free plugins available in the WordPress repository
The premium plugin option might be an pricey solution for you, as you may only want to do this on the virtual products in your store. When adding a virtual product, the checkout looks like this by default:
To remove the billing details from the WooCommerce Checkout, simply follow these steps:
Steps to Remove Billing Details WooCommerce Checkout Page
- Log into your WordPress site and access the Dashboard as the admin user.
- From the Dashboard menu, click on Appearance Menu > Theme Editor Menu. When the Theme Editor page is opened, look for the theme functions file where we will add the function that will remove the billing details from the WooCommerce Checkout page.
- Add the following code to the PHP file:
/** * @snippet Simplify Checkout if Only Virtual Products */ add_filter( 'woocommerce_checkout_fields' , 'njengah_simplify_checkout_virtual' ); function njengah_simplify_checkout_virtual( $fields ) { $only_virtual = true; foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) { // Check if there are non-virtual products if ( ! $cart_item['data']->is_virtual() ) $only_virtual = false; } if( $only_virtual ) { 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']); add_filter( 'woocommerce_enable_order_notes_field', '__return_false' ); } return $fields; }
- To view the changes simply add a Digital downloadable product or a virtual product in the cart as shown below:
- Then proceed to checkout and you will see that some fields in the billing details have been removed as shown below:
That is it. Just add these few lines of code and you can remove WooCommerce checkout fields in a few minutes! Kindly check for any typos as you add the code since any slight mistake in the code you add to the functions.php
would bring down your site.
Conclusion
In this brief tutorial, I have shared a PHP snippet that you can add in your functions.php file to remove the billing details from the WooCommerce Checkout page. However, if you are not familiar with PHP code then you can use the WooCommerce Checkout Field Editor plugin which includes a helpful set of options from which you can add, edit, and remove checkout fields shown on your WooCommerce checkout page. It allows you to do everything from adding and removing fields in the billing and shipping sections to inserting new fields after those sections where you typically find the “Order Notes”.
Joe is an experienced full-stack web developer with a decade of industry experience in the LAMP & MERN stacks, WordPress, WooCommerce, and JavaScript – (diverse portfolio). He has a passion for creating elegant and user-friendly solutions and thrives in collaborative environments. In his spare time, he enjoys exploring new tech trends, tinkering with new tools, and contributing to open-source projects. You can hire me here for your next project.
Similar Articles
- How to Remove or Disable Reviews In WooCommerce
- 26 Best WooCommerce Plugins for Customer Feedback
- 23 Best WooCommerce Plugins for Checkout Page Customization
- How to Redirect to Cart after Login in WooCommerce
- Change Proceed To Checkout Text In WooCommerce
- WooCommerce Redirect after Checkout : How to Automatically Redirect to a Custom Page After Checkout
- How to Get Current Product Category Name in WooCommerce
- How to Make WooCommerce Order Comments Required
- How to Hide PayPal Icon on WooCommerce Checkout Page
- How to Skip Cart and Redirect to Checkout Page WooCommerce
- How to Add Custom WooCommerce Payment Icons Checkout Page
- How to Set Featured Products In WooCommerce
- How to Change Checkout Button Text in WooCommerce [Place Order]
- How to Remove Has Been Added to Your Cart Message WooCommerce
- How to Remove Proudly Powered by WordPress Footer Link
- How to Change PayPal Icon On WooCommerce Checkout Page
- How to Remove Zoom Effect on WooCommerce Product Image
- How to Check If Plugin is Active In WordPress [ 3 WAYS ]
- How to Get Order ID In Woocommerce
- How to Change the WooCommerce ‘Added to Cart’ Notice