Skip to content

Fix the Checkout block rejecting 4-digit Argentine postcodes - #69658

Merged
jorgeatorres merged 4 commits into
trunkfrom
claude/checkout-argentine-postcodes-24a132
Oct 9, 2026
Merged

jorgeatorres merged 4 commits into
trunkfrom
claude/checkout-argentine-postcodes-24a132

Conversation

@ralucaStan

@ralucaStan ralucaStan commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Submission Review Guidelines:

Changes proposed in this Pull Request:

A shopper in Argentina who types a four-digit postcode such as 1213 in the Checkout block sees "Please enter a valid postcode" and cannot place the order. It happens since 11.2.0, while the Store API accepts the same value.

The Checkout block accepts the legacy four-digit Argentine codes again, as it did in 11.1.

  • Why it happens: Argentina is not in the shared rules file, so the block falls back to the postcode-validator package. Unify postcode validation between PHP and Checkout blocks #67780 bumped it from 3.9.2 to 3.10.22, where the Argentina regex made the province letter mandatory. The server has no rule for Argentina.
  • The fix pins the package back to 3.9.2. The shared rules are unchanged (the regenerated file differs only in its version line), so PHP validation does not move. It also undoes 21 countries that 3.10.22 started validating in the browser only; El Salvador, Saint Vincent and the British Virgin Islands were exposed the same way. Vietnam returns to the 11.1 rule, six digits only.
  • Jest pins the Argentine fallback so the next bump fails CI instead of reaching shoppers. Sharing one rule set with the server is Share one postcode rule set across server and both checkouts #68244.

Closes #69643
Closes WOOPLUG-7949

Bug introduced in PR #67780.

How to test the changes in this Pull Request:

  1. On a store with this branch built and Argentina as a selling location, add a product to the cart and open the Checkout block.
  2. Pick Argentina and Ciudad Autónoma de Buenos Aires, type 1213 in Postcode / ZIP and leave the field. On trunk the field shows "Please enter a valid postcode"; with this PR there is no error and the order goes through.
  3. C1213ABC is accepted on both; 142 still shows the error.

Testing that has already taken place:

  • The new Jest cases fail on 3.10.22 (1213, 7540 rejected) and pass on 3.9.2; the validation and checkout form suites pass (291 tests).
  • Regenerating the rules file on 3.9.2 changes only the generatedFrom.version line. pnpm install --frozen-lockfile passes. ESLint clean.
  • Browser: WordPress Studio, WordPress 7.1.3, PHP 8.4, this branch built, store in Argentina with Cash on delivery and Free shipping. 1213 shows no error, the shipping options load, and the order is placed with postcode 1213 on both addresses. 142 shows "Please enter a valid postcode".
  • No PHP changed; the PHP suites were not run.

Milestone

Note: Check the box above to have the milestone automatically assigned when merged.
Alternatively (e.g. for point releases), manually assign the appropriate milestone.

Changelog entry

  • Automatically create a changelog entry from the details below.

  • This Pull Request does not require a changelog entry. (Comment required below)

Changelog Entry Comment

Comment

Created manually.

Use of AI Tools

I used Claude Code for the investigation and the change, and I reviewed the diff.

The 3.10.22 bump that came with the postcode unification made the
province letter mandatory for Argentina, so the Checkout block started
rejecting legacy codes like 1213 that the Store API still accepts.
Argentina is not in the shared rules file, so the block falls back to
the package regex. Every shared-rule country that differs between the
two versions is overridden, so the regenerated artifact only changes
its generatedFrom version. Jest now pins the Argentine fallback.
@ralucaStan
ralucaStan marked this pull request as ready for review October 9, 2026 13:21
@ralucaStan
ralucaStan requested review from a team as code owners October 9, 2026 13:21
@ralucaStan
ralucaStan requested review from jorgeatorres and senadir and removed request for a team October 9, 2026 13:21
@woocommercebot
woocommercebot requested a review from a team October 9, 2026 13:25
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Testing Guidelines

Hi @jorgeatorres @senadir @woocommerce/rubik @woocommerce/monorepo,

Apart from reviewing the code changes, please make sure to review the testing instructions (Guide) and verify that relevant tests (E2E, Unit, Integration, etc.) have been added or updated as needed.

Reminder: PR reviewers are required to document testing performed. This includes:

  • 🖼️ Screenshots or screen recordings.
  • 📝 List of functionality tested / steps followed.
  • 🌐 Site details (environment attributes such as hosting type, plugins, theme, store size, store age, and relevant settings).
  • 🔍 Any analysis performed, such as assessing potential impacts on environment attributes and other plugins, conducting performance profiling, or using LLM/AI-based analysis.

⚠️ Within the testing details you provide, please ensure that no sensitive information (such as API keys, passwords, user data, etc.) is included in this public issue.

@github-actions github-actions Bot added plugin: woocommerce Issues related to the WooCommerce Core plugin. focus: monorepo infrastructure Issues and PRs related to monorepo tooling. labels Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Test using WordPress Playground

The changes in this pull request can be previewed and tested using a WordPress Playground instance.
WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser.

Test this pull request with WordPress Playground.

Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a commit that changes plugin code.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Size Change: 0 B 🆕

Total Size: 0 B

compressed-size-action

@jorgeatorres jorgeatorres left a comment

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.

LGTM. Thank you Raluca!

@coderabbitai

coderabbitai Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: woocommerce/woocommerce/.coderabbit.yml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fc881063-9b95-4496-b830-d8d9be16d9f1

📥 Commits

Reviewing files that changed from the base of the PR and between 2f97a08 and 8c55822.


⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml

📒 Files selected for processing (4)
  • plugins/woocommerce/changelog/fix-wooplug-7949-argentine-postcodes
  • plugins/woocommerce/client/blocks/package.json
  • plugins/woocommerce/client/blocks/packages/public-api/blocks-checkout/utils/validation/test/is-postcode.ts
  • plugins/woocommerce/i18n/postcode-validation-rules.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Walkthrough

Walkthrough

The Checkout block’s postcode-validator dependency and generated version metadata changed to 3.9.2. New tests cover accepted and rejected Argentine postcode formats, and a changelog entry describes the restored acceptance of legacy four-digit postcodes.

Changes

Argentine postcode validation

Layer / File(s) Summary
Restore legacy postcode validation
plugins/woocommerce/client/blocks/package.json, plugins/woocommerce/i18n/postcode-validation-rules.json, plugins/woocommerce/client/blocks/packages/public-api/blocks-checkout/utils/validation/test/is-postcode.ts, plugins/woocommerce/changelog/fix-wooplug-7949-argentine-postcodes
The dependency and generated version metadata changed to 3.9.2. Tests expect 1213, 7540, C1213, C1213ABC, and B7540 to be valid, and 142 and I1213 to be invalid. The changelog states that legacy four-digit Argentine postcodes are accepted again.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium


Merge Risk: ⚪ Minimal · up to 8c558

No concrete merge-blocking risk is established. The change targets acceptance of legacy Argentine postcodes, and the review found no supported additional country mismatch.

Architecture Summary

Architecture risk: 🔵 Low · up to 8c558

The change affects 1 system.

Changed systems: plugins

Architecture concerns
No architecture-level concerns identified.

Review details

Systems and components

  • observed — plugins (service) was modified; 4 changed files map to changed impact.

Before / after behavior

  • observed — Modified behavior in plugins/woocommerce/changelog/fix-wooplug-7949-argentine-postcodes: Added a patch-level fix entry stating that legacy four-digit Argentine postcodes are accepted in the Checkout block again.
  • observed — Modified behavior in plugins/woocommerce/client/blocks/package.json: The postcode-validator dependency version changed from 3.10.22 to 3.9.2.
  • observed — Modified behavior in plugins/woocommerce/client/blocks/packages/public-api/blocks-checkout/utils/validation/test/is-postcode.ts: Added comments and Argentina test cases expecting 1213, 7540, C1213, C1213ABC, and B7540 to be valid, and 142 and I1213 to be invalid.
  • observed — Modified behavior in plugins/woocommerce/i18n/postcode-validation-rules.json: The generatedFrom.version value changes from 3.10.22 to 3.9.2; postcode rules remain unchanged.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check Passed The title clearly and concisely identifies the main change: restoring acceptance of four-digit Argentine postcodes in the Checkout block.
Description check Passed The description directly explains the Argentine postcode regression, the dependency rollback, the affected behavior, testing, and scope.
Linked Issues check Passed The PR satisfies the coding requirement in #69643. It pins postcode-validator to 3.9.2, restores the fallback rule that accepts plain four-digit Argentine postcodes, and adds isPostcode tests for …
Out of Scope Changes check Passed The reviewed changes stay connected to #69643. The dependency pin and generated version update restore the pre-regression fallback behavior. The related browser-only rule reversions for other countrie…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…


✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jorgeatorres jorgeatorres added this to the 11.2.0 milestone Oct 9, 2026
@jorgeatorres
jorgeatorres merged commit 8994a23 into trunk Oct 9, 2026
278 of 280 checks passed
@jorgeatorres
jorgeatorres deleted the claude/checkout-argentine-postcodes-24a132 branch October 9, 2026 14:58
@github-actions github-actions Bot added the needs: documentation The issue/PR requires documentation to be added. label Oct 9, 2026
@woocommercebot

Copy link
Copy Markdown
Collaborator

IMPORTANT: Merging this PR to the appropriate branches is critical to the release process and ensures that the bug does not cause regressions in the future releases.

Cherry picking was successful for release/11.2. Please merge the following PR: [Backport to release/11.2] Fix the Checkout block rejecting 4-digit Argentine postcodes

jorgeatorres pushed a commit that referenced this pull request Oct 9, 2026
…rgentine postcodes (#69662)

Fix the Checkout block rejecting 4-digit Argentine postcodes (#69658)

Co-authored-by: Raluca Stan <ralucastn@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

focus: monorepo infrastructure Issues and PRs related to monorepo tooling. needs: documentation The issue/PR requires documentation to be added. plugin: woocommerce Issues related to the WooCommerce Core plugin.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Checkout block rejects legacy 4-digit Argentine postcodes (e.g. 1213) since 11.2.0

3 participants