删除了仍然需要的Woocommerce Checkout字段

I'm removing specific Woocoomerce checkout fields, as they are not required for pick up orders.

add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );

function custom_override_checkout_fields( $fields ) {
    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['order']['order_comments']);
    return $fields;
}

This works great to remove the fields but doesn't allow me to checkout. I receive the following error:

enter image description here

I've also tried to change the required array item to FALSE, to no avail.

$fields['billing']['billing_company']['required'] = false;
$fields['billing']['billing_address_1']['required'] = false;
$fields['billing']['billing_address_2']['required'] = false;
$fields['billing']['billing_city']['required'] = false;
$fields['billing']['billing_postcode']['required'] = false;
$fields['billing']['billing_country']['required'] = false;
$fields['billing']['billing_state']['required'] = false;

I'm using the Storefront theme as well as Woocommerce 3.1.2

It is an annoying thing in Woocommerce after version 3. Either downgrade to earlier version or allow those details through especially country. You can use css or JS to hide the form input but set the needed country in the woocommerce settings.

Similar problem with "unset field", so just try set priority to "100" or like that example: add_filter('woocommerce_checkout_fields', 'checkout_fields', 100);

Source:

if(!function_exists('checkout_fields')){
    function checkout_fields($fields){
        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']);
        return $fields;
    }
    add_filter('woocommerce_checkout_fields', 'checkout_fields', 100);
}