Repository navigation
Conversation
…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>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
hideoption — no new admin setting:{ "hide": ["[name=\"postcode\"]"] }Why this needed code changes rather than just docs:
hideselectors 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.fieldwrappers (div.field[name="shippingAddress.postcode"],div.field.zip, …).resolveHiddenFields()now runs inonAnchorFound, resolves each selector within the bound form, and widens input/select/textarea matches to their enclosingdiv.fieldso the label disappears too. One generic selector therefore works for every form.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
hidein 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/ snapshotstore.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
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.