Skip to content

Conversation

@bc-akshatkaushik
Copy link
Contributor

@bc-akshatkaushik bc-akshatkaushik commented Dec 22, 2025

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

  • CHANGELOG.md entry added (required for code changes only)

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

@bc-akshatkaushik bc-akshatkaushik force-pushed the CUST-4064 branch 2 times, most recently from b9389ba to 5ab58d6 Compare December 22, 2025 07:43
@bc-akshatkaushik bc-akshatkaushik marked this pull request as ready for review December 23, 2025 01:45
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 true when 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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link

@bc-amandalan bc-amandalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks AK.

@bc-alexsaiannyi
Copy link
Contributor

hey @bc-akshatkaushik, thanks for update! LGTM.

Copy link
Contributor

@bc-yevhenii-buliuk bc-yevhenii-buliuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just don't forget squash all commits before merging the PR.

@bc-akshatkaushik bc-akshatkaushik merged commit 44a9598 into master Dec 28, 2025
1 check passed
@bc-akshatkaushik bc-akshatkaushik deleted the CUST-4064 branch December 28, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants