Magento – Magento 2 firstname, lastname, vat_id custom validation

checkoutmagento2validation

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?

Best Answer

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>
Related Topic