How to Remove the Billing Details from WooCommerce Checkout

Remove Billing Details Checkout 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 WooCommerce Checkout Field Editor

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:

billing details

To remove the billing details from the WooCommerce Checkout, simply follow these steps:

Steps to Remove Billing Details  WooCommerce Checkout Page

  1. Log into your WordPress site and access the Dashboard as the admin user.
  2. 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.
  3. 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;

}
  1. To view the changes simply add a Digital downloadable product or a virtual product in the cart as shown below:billing details
  2. Then proceed to checkout and you will see that some fields in the billing details have been removed as shown below:remove billing details woocommerce

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”.

Similar Articles

  1. How to Change the WooCommerce ‘Added to Cart’ Notice