The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Shipping county not working if country is selected from drop down in v1.0

babblebibbabblebib Member
in Help edited September 2012

One of my customers has just informed me that the county (state) drop down in the 'billing address' section of checkout is not working. The drop down does not contain any options and does not allow them to enter an option either.

This is for the UK, but it seems to do the same with with every country apart from 'United States'.

Interestingly, if I type the country rather than select from the drop-down, the county/state turns into an empty text box, thus allowing users to enter a county/state, however if the customer selects a country, the problem occurs.

My site is here:

Is this a FoxyCart bug or have I messed something up in my JS?
  • fc_adamfc_adam FoxyCart Team

    From my testing, everything seems to be running just fine, if I change my country to the UK the state field changes to an open text box (as it should with the new FoxyComplete functionality in 1.0 - and if I change it to Australia or the US, the state field updated correctly to be a drop down with the required states.

    Could you confirm what browser your customer is seeing this in? If the country is the UK (one which doesn't have any states) there shouldn't be a dropdown but just the open text input for the state field.

    If you haven't already, take a look at this blog post to see the new functionality for the autocomplete in 1.0:
  • Hi, it is a tricky one to reproduce and you may have to set your browser to UK to see it. here are the exact steps:

    Do whatever you need to do to make the country drop-down default to united kingdom (presumably browser regional settings)
    Go to checkout
    The country will default to UK and the county will be an empty drop-down list

    The only way to get the county text box is to change the country to United States (and possibly any of the other countries with states - not checked) and then change it back to united kingdom, then you'll see the text box rather than drop down.

    So it seems to need to display a populated states drop down first in order for the county text box to appear.

    This is all in chrome, but get the same with firefox.

  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    I can't reproduce this in FireFox. My browser is defaulting to US. FoxyCart uses geoip targeting to set that country by default.

    Have you had another UK user confirm that it happens to them also?
  • Hi, all of my UK customers are seeing this.

    If your browser defaults to united states, you would not see the problem as having the country set to USA at any point seems to fix it. However if you default to UK (or I am guessing any country with countys rather than states) you will see it until you select USA and then revert back to UK.

    You will need to figure out a way of having your browser default to UK to see the issue I think.
  • fc_adamfc_adam FoxyCart Team
    edited September 2012

    Thanks for the additional information. We'll do some testing and see if we can work out what's going on.
  • fc_adamfc_adam FoxyCart Team
    edited September 2012

    I've just been able to replicate this. I'll work out what's wrong in the code get a fix up and live as soon as possible.

    [edit] Update: Fix found and in the queue for QA before being pushed to production. We'll let you know when this is live
  • fc_adamfc_adam FoxyCart Team

    Sorry - I forgot to follow up on this, we've rolled a fix for this out for 1.0 - so you shouldn't be seeing that empty dropdown anymore.
  • Hi Sorry to drag up an old post but...........

    To follow on from this I using V1.0 and being UK based have my country defaulted to UK and my 'State' / 'County' defaults to an empty free format input field which is OK. But despite not having 'states' in the UK we do have 'Counties' ( which could also be provided as a drop down list.

    This is currently proving a little awkward for me as my web app is a little dependent on someone having a valid county field (for geoloc stuff) once they have paid and are inserted into my site as a user (subs based system). With the UK / County field being a free format input this means that I will get all sorts of non-standard data which I cant then match to other county records on my site once a payment has gone through.

    So is there a way I can hack / use JS to auto insert a county drop down of my making into the FC cart where the free format County input currently is or is that not possible? Or do you have any other work arounds?

    Also but less importantly is there anything on the cards to add a UK / county drop down as a default function such as selecting USA gets you the states drop down.


    PS all my users will be UK based if that makes a difference.
  • fc_adamfc_adam FoxyCart Team

    Actually it is possible to achieve it with a little javascript:
    <script type="text/javascript">
    FC.locations.config.locations.GB.rt = "county";
    FC.locations.config.locations.GB.rreq = "1";
    FC.locations.config.locations.GB.r = {
    	"Avon": {
    		"n": "Avon",
    		"c": "Avon",
    		"alt": ["Alt Spelling 1", "Alt Spelling 2"],
    		"boost": ""
    	"Bedfordshire": {
    		"n": "Bedfordshire",
    		"c": "Bedfordshire",
    		"alt": [],
    		"boost": ""

    You'd paste that right before the closing </head> tag of your checkout template - and you'd need to expand on that locations object to include all of your counties. Note that the 'n' and 'c' variables would be just the county name, and if there are alternate spellings for the county, you can add those in the 'alt' array as I have with 'Avon' above. If there are no alternate spellings, then leave it as an empty array as I have for 'Bedfordshire'.

    In terms of adding it as a default - as far as I'm aware, the state/county entry isn't generally required for shipping in the UK - is that right?
  • btw, how is possible get country list with api? i just want make pre-fill of it ...
    and use in cart.

  • fc_adamfc_adam FoxyCart Team

    It's not possible to get the country list via API.

    What exactly are you wanting to do? Display a country select field on your cart template?
Sign In or Register to comment.