fix(customers): CUST-4064 Update state and zip optionality to be loaded via v1 country-states#2585
fix(customers): CUST-4064 Update state and zip optionality to be loaded via v1 country-states#2585bc-akshatkaushik merged 2 commits intomasterfrom
Conversation
b9389ba to
5ab58d6
Compare
There was a problem hiding this comment.
Pull request overview
This PR implements dynamic postal code (zip) validation based on country selection by integrating with the v1 country-states API. When a user selects a country in address or registration forms, the system now dynamically determines whether the postal code field is required based on the requiresPostalCodes property from the API response, similar to how state/province field requirements are handled.
Key Changes:
- Added dynamic postal code requirement logic to state-country module
- Integrated zip field validation handling in account and registration forms
- Default zip requirement behavior falls back to
truewhen API doesn't specify
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| assets/js/theme/common/state-country.js | Added makeZipRequired/makeZipOptional helper functions and zip validation logic that reads requiresPostalCodes from country API response |
| assets/js/theme/auth.js | Added zip element selection and dynamic validation for registration form based on required attribute state |
| assets/js/theme/account.js | Added zip element selection and dynamic validation for address form based on required attribute state |
| package-lock.json | Version bump to 6.18.0-rc.1 |
| CHANGELOG.md | Added entry for CUST-4064 dynamic postal code validation feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
b1c78d0 to
0c86b15
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
0c86b15 to
ea02ede
Compare
…ed via v1 country-states
ea02ede to
3a1a7ff
Compare
…al variable for elements
|
hey @bc-akshatkaushik, thanks for update! LGTM. |
bc-yevhenii-buliuk
left a comment
There was a problem hiding this comment.
LGTM! Just don't forget squash all commits before merging the PR.
What?
Update state and zip optionality to be loaded via v1 country-states to dynamically load state and zip optionality based on the user's Country selection interation
Related PRs:
Requirements
Tickets / Documentation
Screenshots (if appropriate)
Tested E2E with associated PRs linked above
Before
Screen.Recording.2025-12-23.at.12.38.00.pm.mov
After
Screen.Recording.2025-12-23.at.12.42.16.pm.mov
@bigcommerce/team-customers