How to remove billing address for logged in users Woocommerce | themelocation

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:

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.

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;
}

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.

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

 

No comments yet.

Leave a Reply