Help with shipping logic country codes

Just need a bit of help with something no doubt very simple for someone with half a clue...

Since we're in the UK we'd like to have the islands of the Isle of Man, Guernsey and Jersey dish up the same shipping options as mainland UK. At the moment they serve up the more expensive international shipping prices.

I have tried to include them like this:

var country_code = address.country;
if (country_code == "GB", "GG", "IM", "JE") {
if (FC.json.total_item_price < 10) {
FC.customFlatRates.add(1, 1.99, 'Standard - ', '3-4 days');
FC.customFlatRates.add(2, 2.99, 'Priority - ', '1-2 days');
} else {
FC.customFlatRates.add(3, 0, 'Free Shipping - ', '3-4 days');
FC.customFlatRates.add(4, 2.99, 'Priority - ', '1-2 days');
}
} else {
FC.customFlatRates.add(5, 4.99, 'Royal Mail', 'Airmail');
}


But this has broken something as now when other international countries are selected it seems to only serve up the UK shipping rates.

I don't know what I've done. I've swapped it back to simply "GB" for now, as it was, but I'd like to make those islands the same as UK rates.

Thanks
Comments
  • fc_adamfc_adam FoxyCart Team
    edited September 2015
    @Pecan,

    You were close - instead of this:

    if (country_code == "GB", "GG", "IM", "JE") {

    You'd want this:

    if (jQuery.inArray(country_code, ["GB", "GG", "IM", "JE"]) > -1) {

    That should hopefully get you up and running.
  • Thanks Adam, I'll give that a go. :)
  • Seems to work well. Thanks again Adam. ;)
  • fc_adamfc_adam FoxyCart Team
    Awesome!
Sign In or Register to comment.