Skip to main content

To customize the WooCommerce checkout and remove the address fields, you’ll typically want to create a child theme (to prevent updates from overwriting your changes) and then use hooks to modify the checkout page fields.

Here’s how to do it:

1. Add Custom Code in Your Child Theme’s functions.php

If you haven’t set up a child theme yet, it’s best to do that first so your changes are preserved during theme updates. Then, add the following code to the functions.php file in your child theme:

 

// Remove billing and shipping address fields on WooCommerce checkout
add_filter( 'woocommerce_billing_fields', 'remove_checkout_billing_address_fields' );
add_filter( 'woocommerce_shipping_fields', 'remove_checkout_shipping_address_fields' );

function remove_checkout_billing_address_fields( $fields ) {
unset( $fields['billing_address_1'] );
unset( $fields['billing_address_2'] );
unset( $fields['billing_city'] );
unset( $fields['billing_postcode'] );
unset( $fields['billing_state'] );
unset( $fields['billing_country'] );
return $fields;
}

function remove_checkout_shipping_address_fields( $fields ) {
unset( $fields['shipping_address_1'] );
unset( $fields['shipping_address_2'] );
unset( $fields['shipping_city'] );
unset( $fields['shipping_postcode'] );
unset( $fields['shipping_state'] );
unset( $fields['shipping_country'] );
return $fields;
}

Explanation

Billing Fields: The woocommerce_billing_fields filter modifies the billing section. We unset all the address fields (like billing_address_1, billing_city, etc.).
Shipping Fields: Similarly, woocommerce_shipping_fields modifies the shipping section. The code unsets the address fields for shipping.

2. Optional: Disable Shipping Fields Entirely

If you don’t need shipping information at all, you can disable the shipping fields by adding this code:

// Disable shipping address fields
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_false' );

3. Save and Test

After adding the code, go to your WooCommerce checkout page, and you should see that the address fields are removed from both billing and shipping sections.