WooCommerce Checkout: hide Billing details

enter image description here

i don't want to take billing information, i want to hide this form input, and want to organize the checkout page, i have tried to

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

function custom_override_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['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']);
return $fields;
}

unset the billing details but this don't hide "Billing details" label, and unable to organize the checkout page, please help, waiting for reply, thanks in advance.

1 answer

  • answered 2018-11-08 15:24 Alex Vasilyev

    add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields', 100 );
    
    function custom_woocommerce_billing_fields(){
        return [];
    }
    
    add_action( 'wp_head', 'include_styles' );
    
    function include_styles() {
        if ( is_checkout() ) {
           echo '
                <style>
                    .woocommerce-billing-fields h3 {
                        display: none;
                    }
                </style>
           ';
        }
    }