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.
Stack Exchange network consists of 181 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.Visit Stack Exchange
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
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:
input.htmlinto a module under a similar directory
checkout_index_index.xmland create a deep XML structure to target
postcodeand specify an
elementTmpl. The last
<item name="postcode"> <item name="elementTmpl" xsi:type="string">MyCompany_MyModule/element/postcode</item> </item>