1

I want to change the validation of firstname, lastname and vat_id in checkout. I've already changed the telephone validation by changing validation item in checkout_index_index.xml like so:

<item name="telephone" xsi:type="array">
    <item name="validation" xsi:type="array">
        <item name="phoneCustom" xsi:type="string">true</item>
    </item>
</item>

The problem is that I cannot find where firstname, lastname and vat_id declarations are. In which xml should I look?

1

It turns out that I've only had to add additional items to the checkout_index_index.xml file. Eg:

<item name="firstname" xsi:type="array">
    <item name="validation" xsi:type="array">
        <item name="my-custom-validation" xsi:type="string">true</item>
        <item name="letters-only" xsi:type="string">true</item>
    </item>
</item>
|improve this answer|||||
0

Firstname, lastname and vat_id are attributes, So check Magento\Checkout\Block\Checkout\LayoutProcessor::process, this process method generate actual array of input field. If you need extra validation then create your own by xml.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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