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.

"Restricting Countries" bug in Firefox

fewdiodavefewdiodave Member
in Bugs & Feature Requests edited September 2014
I'm running a 0.7.2 shop at I have used the snippet at the bottom of my post to restrict countries to the U.S. and Canada. It works fine in most browsers, but a bug seems to have popped up in Firefox. As soon as a customer using Firefox enters their state, the popup "We only ship to U.S. and Canada" message fires. If you just click "Okay" on the error message and enter your zip code, it functions correctly and the sale can be completed. But it's causing confusion with customers who just stop there and email us telling us they can't order. I'm scared to think about how many customers just don't even bother and we lose the sale.

Any insight?

Thanks for any help!
<script type="text/javascript" charset="utf-8">
  // Restrict the locations array
  var newLocations = [];
  var allowedCountries = ["US", "CA"];
  for (var i = 0; i < FC.locations.config.locations.length; i++) {
    if (jQuery.inArray(FC.locations.config.locations[i].cc2, allowedCountries) > -1) {

  FC.locations.config.locations = newLocations;
  FC.locations.init(); // Update the countries and regions based on the modified locations array

  // Default to the US if not within our allowed countries
  if (jQuery.inArray(jQuery("#customer_country").val(), allowedCountries) == -1) {
    jQuery('#customer_country, #shipping_country').val('US');
    jQuery('#customer_country_name, #shipping_country_name').val('United States');

  // Apply custom code to validateLocationName to alert when an unsupported country is typed in
  defaultValidateLocationName = FC.checkout.validateLocationName;

  customValidateLocationName = function(fieldName) {
    fieldName = fieldName[0];
    if (fieldName.indexOf("country") != -1) {
      var fieldValue = jQuery("#"+fieldName+"_name").val();
      var countryFound = false;
      for (var i = 0; i < FC.locations.config.locations.length; i++) {
        if (FC.locations.config.locations[i].cn == fieldValue) {
          countryFound = true;

    if (!countryFound) {
      alert("We only ship to U.S. and Canada");

    // Call the default function

  FC.checkout.override("validateLocationName", "customValidateLocationName");

  • fc_adamfc_adam FoxyCart Team

    I just tested your checkout on FireFox version 31, and I don't see the alert displaying on page load. Can you reproduce this yourself? If so, what version are you running?
Sign In or Register to comment.