How to delete unnecessary fields in the WooCommerce cart?

How to delete unnecessary fields in the WooCommerce cart?

By default, the WooCommerce checkout page has many fields for the user to fill out. You don't always need them. Plus, they can reduce the conversion of your store.

To remove the fields we do not need, we will use the "woocommerce_billing_fields" and "woocommerce_shipping_fields" filters.

For remove fields in billing section use next code:

add_filter('woocommerce_billing_fields', function($fields){
    unset($fields['billing_company']);
    unset($fields['billing_address_1']);
    unset($fields['billing_address_2']);
    unset($fields['billing_state']);
    unset($fields['billing_city']);
    unset($fields['billing_postcode']);
    return $fields;
}, 10, 1 );

For remove fields in shipping section use next code:

add_filter('woocommerce_shipping_fields', function($fields){
    unset($fields['shipping_company']);
    return $fields;
}, 10, 1 );

You can insert this code to your theme functions.php file and customize fields list.

Read more