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.

Javascript Woes

jlivingstonjlivingston Member
in Help edited December 2014
Hi Guys,

Would you mind looking at a checkout template for me? I'm trying to implement the custom javascript posted here:

Specifically the "removeStates" method. I've used this code on a couple of other sites, though I don't think I've executed that particular method before. For whatever reason, it doesn't seem to be working at all.

I'll whisper the store URL.

  • brettbrett FoxyCart Team
    We'll take a look.
  • fc_adamfc_adam FoxyCart Team

    So there are a few things happening on your checkout there.

    * You have a jQuery include in there that you'll want to remove
    * It looks like you're rolling your own country select input? Is there a reason you're doing that instead of just restricting the countries?
    * You're currently calling the removeStates function in 3 different places

    So the script itself is working just fine - you're currently just restricting the shipping addresses, and if you check the box to enter a different shipping address, you won't be able to select those states for the US.

    If you need to allow billing to be from anywhere - but only ship to a certain subset of states, I'd recommend approaching it this way:
    FC.locations.limitCountriesTo(['US', 'CA'], 'shipping');

    That will display the shipping address always, and instead of having a checkbox to add a different shipping address, it will include a link to copy the billing to the shipping. That way you can enforce that restricted shipping requirement.

    You'll then want to remove all the javascript related to adding in that custom select box on the country fields, and the other two places that you were calling removeStates().
Sign In or Register to comment.