Skip to content

feat(postcode-lookup): hide address fields via PostcodeLookup Override - #588

Closed
mfilip wants to merge 1 commit into
mainfrom
devin/1788424557-postcode-lookup-hide-fields
Closed

mfilip wants to merge 1 commit into
mainfrom
devin/1788424557-postcode-lookup-hide-fields

Conversation

@mfilip

@mfilip mfilip commented Sep 3, 2026 •

Copy link
Copy Markdown
Member

Summary

Lets merchants hide the postcode (or any address) field so only the Postcode Lookup search box is shown, using the existing Advanced > PostcodeLookup Override textarea and the lookup library's native hide option — no new admin setting:

{ "hide": ["[name=\"postcode\"]"] }

Why this needed code changes rather than just docs:

  • hide selectors are resolved by the library against the form scope, but Magento renders the same [name="postcode"] input in several forms (shipping, billing, customer address) with different .field wrappers (div.field[name="shippingAddress.postcode"], div.field.zip, …). resolveHiddenFields() now runs in onAnchorFound, resolves each selector within the bound form, and widens input/select/textarea matches to their enclosing div.field so the label disappears too. One generic selector therefore works for every form.
  • The country watcher now calls this.hideFields() / this.unhideFields() alongside toggling the lookup box, so hidden fields reappear when a non-UK country is chosen and are re-hidden when switching back to a UK territory.

Library behaviour otherwise applies: hidden fields are revealed on address selection and via the auto-rendered "Enter address manually" link. With no hide in the override nothing changes (verified on the shipping fixture: no unhide link, field stays visible).

Also documents the option in the README and rebuilds binding.min.js / snapshot store.js.

Link to Devin session: https://app.devin.ai/sessions/1d9b44f5333d49adaf2e80f91611db0c
Open in Devin Desktop: https://app.devin.ai/desktop/session/1d9b44f5333d49adaf2e80f91611db0c?variant=devin
Requested by: @mfilip


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…up Override

Resolve `hide` selectors from the override within the bound address form,
widen input selectors to their .field wrapper, and re-hide/unhide the
fields as the country toggles between UK and non-UK.

Co-Authored-By: Marcin Filip <marcin.filip@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@mfilip mfilip closed this Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant