Disable Billing Address Fields On WooCommerce Checkout Page

I saw this WooCommerce question the other day on Reddit and wanted to provide another (of the many) solutions already online for it. Not in the “Mine is better” sense but more of the “I’m learning how to do this too” thing. This example is more of an edge case than anything else but is doable with some PHP. And, a good learning opportunity. So keep readin’…

Custom WooCommerce and Shopify Solutions

Discover useful WooCommerce and Shopify custom solutions for your online store today at affordable prices!

Note: All examples in this post are part of a development/learning WooCommerce install using the default Storefront theme. PHP code is placed in the child theme’s function.php file.

The Newsletter for PHP and MySQL Developers

Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.

I’m not 100% sure this works for every scenario because sometimes the billing and shipping addresses may differ. But, if you only want the customer to fill out the shipping address fields on the WooCommerce Checkout Page, you can disable some of those similar Billing address fields.

By default in the Storefront theme, on the Checkout Page, you have this Billing details section:

For a more custom learning experience for me (and you!) and a better overall checkout experience (I think), I’ll use a combination of billing and shipping fields. Since both the billing and shipping sections have some repeating address fields, I’ll keep just those from the shipping section.

Here is the code I use in the child theme’s functions.php file:

add_filter( 'woocommerce_checkout_fields', 'woo_no_billing_fields' );

function woo_no_billing_fields( $fields ) {
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['shipping']['shipping_first_name'] );
unset( $fields['shipping']['shipping_last_name'] );
return $fields;

Now we have the combination of billing and shipping checkout fields available for a complete order:

This Isn’t Bulletproof

I’d like to emphasize again that I don’t necessarily think this is an ideal checkout process for every type of online store. But, may work well for a specific kind of situation.

One immediate problem I see is that if the Ship to a different address checkbox is not checked, does that wreck the checkout process? I will have to research a solution and write an article on that in the future.

Do you have a need for this exact customization for your WooCommerce online store? Consider hiring me to complete this for you, hassle-free. Contact me for more information.

Credit Resources

I am so grateful for all of the fantastic resources and content available online. This article is an example of those I studied in order to solidify these concepts: https://www.businessbloomer.com/woocommerce-checkout-customization/.

Thank you for reading this post. Please share it with someone else who would enjoy it as well.

Josh Otwell has a passion to grow as a PHP Developer, SQL expert, and technical blogger/writer.

Disclaimer: The majority of examples in this post, are performed in a personal development/learning workstation environment and should not be considered production quality or ready. Your particular goals and needs may vary. Like always, just because you can do something doesn’t mean you should. My opinions are my own.

More ways I can help

Disclosure: Some of this blog post’s services and product links are affiliate links. At no additional cost to you, should you make a purchase by clicking through one of them, I will receive a commission.

The Newsletter for PHP and MySQL Developers

Receive a copy of my ebook, “10 MySQL Tips For Everyone”, absolutely free when you subscribe to the OpenLampTech newsletter.

πŸ“° Get your brand, product, or service the attention it deserves with affordable classified ad placement in the OpenLampTech newsletter. I appreciate your support!

Hey thanks for commenting! Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.