Skip to content

Remove optional ? in PT zip_regex#493

Open
AndreaSmith053122 wants to merge 2 commits into
mainfrom
pt-seven-digit-postal-code
Open

Remove optional ? in PT zip_regex#493
AndreaSmith053122 wants to merge 2 commits into
mainfrom
pt-seven-digit-postal-code

Conversation

@AndreaSmith053122
Copy link
Copy Markdown

What are you trying to accomplish?

Portugal postal code format should be XXXX-XXX, all numeric. Our current regex does not require the second set of three digits, despite it being the required format since 1998.

Contributes to https://github.com/shop/issues-checkout/issues/11587

What approach did you choose and why?

  • Remove the ? part of the regex making the second set of digits optional.
  • Leave the ? that makes the - optional.

What should reviewers focus on?

I don't think there's any way to flag these changes for a gradual rollout, but I'd be happy to hear otherwise.

The impact of these changes

[After services start using the new gem version]

  • Customers will be required to enter the full postal code
  • Merchants touching old records will need to put in the full postal code. We expect Atlas to be able to provide the correct value.

Checklist

  • I have added a CHANGELOG entry for this change (or determined that it isn't needed)

@AndreaSmith053122 AndreaSmith053122 requested review from a team and ananyaneogi and removed request for a team May 20, 2026 15:15
@ananyaneogi
Copy link
Copy Markdown
Member

Might be good to add a changelog post ? Given that anyone consuming worldwide will start rejecting 4-digit PT zips now.

Comment thread data/regions/PT.yml
tax_inclusive: true
group: European Countries
group_name: Europe
zip_regex: "^(PT?-?)?\\d{4}(-?\\d{3})?$"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

lets add a test for this regex behaviour change

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.

2 participants