How can I hide some fields from addressfield module (for example zip code) on checkout process if certain country is selected? E.G. If US country selected then hide postal code field. If CA country selected then show postal code.

  • The module developers have gone to great lengths to ensure that address fields are valid for the selected country. A zip code is a required part of a full US address, hence its inclusion. I'm not sure how easy it's going to be to unpick that, if memory serves the info all comes from a big array and I don't know if there's a non-hacky way to intercept it – Clive Jul 16 '15 at 9:29

Clive is correct. The module already adjusts the form as appropriate. If you aren't seeing this, you must have something interfering with the Ajax based update of the form element.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.