Skip to content

Magento 2 – How to find layout path for a form input checkout_index_index.xml

I was wondering how I can find the full path to a component/form field on the checkout?
For instance, let’s say I wanted to add some custom validation to a new field I have added on the checkout (within the shipping methods block). I know I need to add the path for my validation in checkoujt_index_index.xml. A bit like this (I know this isn’t correct):

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceBlock name="checkout.root">
        <arguments>
            <argument name="jsLayout" xsi:type="array">
                <item name="components" xsi:type="array">
                    <item name="checkout" xsi:type="array">
                        <item name="children" xsi:type="array">
                            <item name="sidebar" xsi:type="array">
                                <item name="children" xsi:type="array">
                                    <item name="summary" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="summary-discount" xsi:type="array">
                                                <item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount</item>
                                                <item name="children" xsi:type="array">
                                                    <item name="errors" xsi:type="array">
                                                        <item name="sortOrder" xsi:type="string">0</item>
                                                        <item name="component" xsi:type="string">Magento_SalesRule/js/view/payment/discount-messages</item>
                                                        <item name="displayArea" xsi:type="string">messages</item>
                                                    </item>
                                                </item>
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>
</body>

How do I even go about finding what path I would need?

P.s. I know this path isn’t correct (It’s just copied from the Magento docs), I guess that actual question is, how the heck do I find that nested path (or any nested path that I may need!)? Where do I even begin?!

Thanks