WooCommere Remove Checkout Billing Fields For Virtual Product Orders

WooCommerce checkout with reduced fields due to virtual product being the only product in the order


There are no pre-requisites in order for you to be able to implement this solution.

How To Implement This Solution?

Simply copy the pre-coded solution to your active theme’s functions.php or preferably the Code Snippets Plugin.

About this Solution

This snippet checks the cart contents and will remove the billing fields if there are only virtual products in the order.

This means your customers will only need to enter their first name, last name, email address, and optionally any order notes.

If you wish to remove Order notes you can view the guide here: How to remove the Order Notes section from the WooCommerce checkout.

Keep in mind, some payment gateways require billing fields, particularly the postcode, to process orders.

 * Snippet Name:	WooCommere Remove Checkout Billing Fields For Virtual Products
 * Snippet Author:	ecommercehints.com

add_filter( 'woocommerce_checkout_fields' , 'ecommercehints_remove_checkout_billing_fields_if_virtual_product' );
function ecommercehints_remove_checkout_billing_fields_if_virtual_product( $fields ) {

   $only_virtual_in_cart = true; // If there is a physical product too, don't remove the fields

   foreach( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {

      if ( ! $cart_item['data']->is_virtual() ) {
		  $only_virtual_in_cart = false;   
	if ($only_virtual_in_cart) {
     return $fields;

Snippet Benefits

  • Reduce friction at the checkout by removing unnecessary fields.
  • By reducing the number of steps you are more likely to increase the conversion rate and reduce the checkout abandonment rate.
WooCommerce Conversion Rate Optimisation (CRO) eBook
100 WooCommerce Conversion Rate Optimisation Tips

Leave a Reply

If you are going to write code in the comments, please wrap it between code tags.

Your email address will not be published. Required fields are marked *

Other Recent Guides

Subscribe To Emails

Get exclusive WooCommerce tips that I only share with email subscribers

Join hundreds of other subscribers