• Resolved Tishina

    (@gkaralov)


    Hello,

    I’m trying to remove/hide the country field during the checkout process via plugin/s and everything I remove it, the order cannot be completed.

    Is there a workaround solution?

    Wish you a happy day!

    • This topic was modified 6 years, 3 months ago by Tishina.
Viewing 10 replies - 1 through 10 (of 10 total)
  • Hi!

    Could you please paste here the URL of your site? I’d like to take a look at it. In any case, the info from the country field is used to check if that particular shipping zone matches with the location of the customer (and offers a shipping rate accordingly). Is there any particular reason you want to hide it? Or is it not related with shipping but billing?

    Thread Starter Tishina

    (@gkaralov)

    Here it is.

    It serves no purpose, the goal is to reduce the fields in the checkout for more simplicity points.

    • This reply was modified 6 years, 3 months ago by Tishina.
    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi, @gkaralov!

    function custom_override_checkout_fields( $fields ) {
    unset($fields['billing']['billing_country']);
    return $fields;
    }
    
    add_filter('woocommerce_checkout_fields','custom_override_checkout_fields');

    For further help, please see https://docs.woocommerce.com/document/tutorial-customising-checkout-fields-using-actions-and-filters/

    Thread Starter Tishina

    (@gkaralov)

    Hi, @rynald0s,

    This made the field disappear but the same problem persists – orders cannot be completed.

    Rynald0s

    (@rynald0s)

    Automattic Happiness Engineer

    Hi, @gkaralov!

    I’ve worked through your checkout process and was able to process successfully, and that with the billing_country removed.

    Am I missing something or have you resolved the issue in the meantime?

    Cheers!

    Thread Starter Tishina

    (@gkaralov)

    Hi, @rynald0s,

    Here’s a screenshot after the field was removed.

    I’ll try to replicate it through other device tomorrow and see if this happens again or it’s just me..

    If you set “I sell to only one country” in WooCommerce settings, that country will appear in checkout and the country field will be readonly.

    You can hide it with some custom css:

    #billing_country_field {
      display: none;
    }

    Custom CSS can be entered at:
    Dashboard > Appearance > Customize > Additional CSS

    If you have any PHP code snippets relating to this I suggest you remove them.

    Even though now the country is hidden, it must still be there in the markup so the form handler knows the country and so is able to complete orders.

    I think it does serve a purpose if users can see it. The nature of the internet is that users may come from any country. They may miss your notice that says “We only sell to — country”. When they get to checkout, and can’t alter the country, they will realise you serve one country only. You will not want to get orders from addresses which are in another country.

    Thread Starter Tishina

    (@gkaralov)

    Thank you @lorro, it worked! ??

    Well, I doubt that visitors will perceive that orders are handled in their country – simply because the website is in Bulgarian ??

    Have a good day,
    Georgi

    The country here is the customer’s country, not the shop address country. What I’m saying is you could get a visitor from another country who might not realise that you don’t ship to their country, because now there is no country field.

    Thread Starter Tishina

    (@gkaralov)

    Thanks but that is highly unlikely because all the site’s content is in Bulgarian. For now, we only operate on a domestic market, although if we ever receive an order from abroad we might still find a way to ship it.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Removing/Hiding Country Field’ is closed to new replies.