By default, any line that starts with ‘unset’ will remove the corresponding field. Remove each line, starting with ‘unset,’ for any field you wish to keep as part of your checkout.
add_filter("woocommerce_checkout_fields", "mlc_remove_checkout_fields");
function mlc_remove_checkout_fields($fields)
{
unset($fields["billing"]["billing_first_name"]);
unset($fields["billing"]["billing_last_name"]);
unset($fields["billing"]["billing_company"]);
unset($fields["billing"]["billing_address_1"]);
unset($fields["billing"]["billing_address_2"]);
unset($fields["billing"]["billing_city"]);
unset($fields["billing"]["billing_postcode"]);
unset($fields["billing"]["billing_country"]);
unset($fields["billing"]["billing_state"]);
unset($fields["billing"]["billing_phone"]);
unset($fields["order"]["order_comments"]);
unset($fields["billing"]["billing_email"]);
unset($fields["account"]["account_username"]);
unset($fields["account"]["account_password"]);
unset($fields["account"]["account_password-2"]);
return $fields;
}As an example, the code snippet below will remove the Billing Phone and Order Comments, while leaving all the other checkout fields.
add_filter("woocommerce_checkout_fields", "mlc_remove_checkout_fields");
function mlc_remove_checkout_fields($fields)
{
unset($fields["billing"]["billing_phone"]);
unset($fields["order"]["order_comments"]);
return $fields;
}