0

I need to add a ID or Class in the zip code input field on checkout page, but I can't find where this element is rendered.

Any suggestion?

Thank's

1 Answer 1

1

The input is rendered with: magento/module-ui/view/frontend/web/templates/form/element/input.html. While you could override it, it is used very broadly.

My recommendation is to specify a custom template. This would be done via the following approximate steps:

  • Copy the input.html into a module under a similar directory view/frontend/web/templates/...
  • Create checkout_index_index.xml and create a deep XML structure to target postcode and specify an elementTmpl. The last <item/>s are: shippingAddress > children > shipping-address-fieldset > children > postcode.
  • The postcode item would be something like this:

<item name="postcode">
    <item name="elementTmpl" xsi:type="string">MyCompany_MyModule/element/postcode</item>
</item>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.