Removing billing fields in WooCommerce

A website that sells wallpaper images or e-books will not need such fields and company information so this snippet helps to remove the unnecessary fields from the checkout page. In the below image, you can see the default checkout form.

Before applying snippet


Now let’s insert the following to function.php in your child theme.

// removing unnecessary billing fields

function wps_remove_checkout_fields( $fields ) {

    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_phone']); 

    /**
     * unset($fields['billing']['change_your_field_here']);
     * available options to remove: billing_first_name, 
     * billing_last_name, billing_company, billing_address_1,
     * billing_address_2, billing_city, billing_postcode, billing_country,
     * billing_state, billing_email, billing_phone 
     */

    return $fields;

}

add_filter( 'woocommerce_checkout_fields' , 'wps_remove_checkout_fields' );

Here in the above function, we are unsetting the fields which we do not want to display. After applying the snippet you can see the extra fields have been removed just check the final result image below.

After applying snippet

Edit WooCommerce Products from Frontend

Leave a Comment

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

Scroll to Top