Home Forums Basel support forum Remove Country from Checkout

Remove Country from Checkout

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16888

    svaldesm
    Participant

    Hello,

    I’ve managed to remove some fields from the checkout via two functions:

    
    /*Make fields from Checkout optional*/
    add_filter( 'woocommerce_default_address_fields' , 'custom_override_default_address_fields' );
    function custom_override_default_address_fields( $address_fields ) {
         $address_fields['company']['required'] = false;
         $address_fields['country']['required'] = false;
         $address_fields['address_2']['required'] = false;
         $address_fields['city']['required'] = false;
         $address_fields['postcode']['required'] = false;
         return $address_fields;
    }
    
    /* Remove fields from Checkout */
    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
    function custom_override_checkout_fields( $fields ) {
         unset($fields['billing']['billing_company']);
         //unset($fields['billing']['billing_country']);
         unset($fields['billing']['billing_address_2']);
         unset($fields['billing']['billing_city']);
         unset($fields['billing']['billing_postcode']);
         return $fields;
    }
    

    Nevertheless, when I try to buy something, I get an error. If remove the “unset” for country, it works.

    How can I fix this? I only ship in one contry (which is default in WooCommerce config and appears as default).

    Thanks

    #16890

    Artem Temos
    Keymaster

    Hello,

    This field comes with WooCommerce plugin, and not with our theme. Sorry, but additional customization of third party plugins is out of our theme support scope.

    Regards

    #16891

    svaldesm
    Participant

    Thanks. At least, do you have any clue where this goes? Maybe some docs you remember. So far nothing.

    Thanks!

    #16892

    Artem Temos
    Keymaster

    We suggest you to try this plugin to manage your checkout fields https://wordpress.org/plugins/woocommerce-checkout-manager/

Viewing 4 posts - 1 through 4 (of 4 total)