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:
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.
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]