Wocommerece removing all the shipping and billing details fields

Somtime we don't need the wordpress wocommerece shipping and billing details fields on the checkout page so we can easily remove all the fields or the fields that we really don't need or required. So There is filter called the woocommerce_checkout_fields for the woocommerece. We can call a custom function that have the code to remove or unset the billing and shipping fields for the checkout page. Same as other wordpress filters we can apply this filter in the functions.php file of the theme folder. Here below is the code in which i totally removed all the billing and shipping fields.

<?php
// FILTER FOR THE CHECKOUT FIELDS
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

// CUSTOM FUNCTION TO REMOVE ALL THE BILLING AND SHIPPING FIELDS OF THE CHECKOUT PAGE
function custom_override_checkout_fields( $fields ) 
{
    // ALL BILLING 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_address_2']);
    unset($fields['billing']['billing_postcode']);
    unset($fields['billing']['billing_company']);
    unset($fields['billing']['billing_last_name']);
    unset($fields['billing']['billing_email']);
    unset($fields['billing']['billing_city']);
    
    // ALL SHIPPING FIELDS
    unset($fields['shipping']['shipping_first_name']);
    unset($fields['shipping']['shipping_last_name']);
    unset($fields['shipping']['shipping_company']);
    unset($fields['shipping']['shipping_address_1']);
    unset($fields['shipping']['shipping_address_2']);
    unset($fields['shipping']['shipping_city']);
    unset($fields['shipping']['shipping_postcode']);
    unset($fields['shipping']['shipping_country']);
    unset($fields['shipping']['shipping_state']);
    unset($fields['shipping']['shipping_phone']);
    unset($fields['order']['order_comments']);
    unset($fields['shipping']['shipping_address_2']);
    unset($fields['shipping']['shipping_postcode']);
    unset($fields['shipping']['shipping_company']);
    unset($fields['shipping']['shipping_last_name']);
    unset($fields['shipping']['shipping_email']);
    unset($fields['shipping']['shipping_city']);
    return $fields;

}

?>

Students Tech Life