How to remove billing address for logged in users in Woocommerce?

Many Woocommerce shop owners wants to remove Billing details Form from the checkout page, when the user is already Logged-in as this is very annoying for the users.

Here is the default form in the checkout page:

Our team at Themelocation is comprised of WordPress developers of high expertise

  • We can maintain, support and manage your single, or all your clients, website with dedication
  • Our skills are at your disposal.

Book a Call

2015-10-28_1206

Now We are going to remove this with a help of a simple Code. Add the below Code to your theme’s functions.php file.

[codesyntax lang=”php”]

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
function custom_override_checkout_fields( $fields ) {
    if( is_user_logged_in() ){
        unset($fields['billing']);
		$fields['billing'] = array();
    }
    return $fields;
}

[/codesyntax]

Save the file by clicking update button.

Now, if you’ll go to checkout page after logging in you won’t see the billing address form.

2015-10-28_1210

Now we also need to hide heading of billing details. To do this adds the following css in style.css file and the heading will be removed.

[codesyntax lang=”php”]

.woocommerce-billing-fields h3 {
    display: none;
}

[/codesyntax]

 

Waqas

I hope you enjoy reading this blog post. If you want my team to do WooCommerce Maintenance for you, click here.

Leave a Comment

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