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.

woocommerce-all-address-fields

You can remove address field layouts, so you have just name and email.

woocommerce-all-name-email-fields

Remove Billing Fields

This is all done with the woocommerce_billing_fields filter, so in your themes functions.php you can add the following…

View the code on Gist.

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.

View the code on Gist.

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…

View the code on Gist.

Ref. & Ref

Share:

Leave a Reply