0

Is it possible to move an argument defined in a layout?

For example I want to move the authentication jsComponent in Magento_Checkout/view/frontend/layout/checkout_index_index.xml to be a child of my custom step. I have tried things like this:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    layout="1column"
    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="steps"
                                    xsi:type="array">
                                    <item name="children"
                                        xsi:type="array">
                                        <!-- The new step you add -->
                                        <item name="custom-step"
                                            xsi:type="array">
                                            <item name="component"
                                                xsi:type="string">VENDOR_MODULE/js/view/custom-step</item>
                                            <!--To display step content before shipping step "sortOrder" value should be < 1-->
                                            <!--To display step content between shipping step and payment step  1 < "sortOrder" < 2 -->
                                            <!--To display step content after payment step "sortOrder"> 2 -->
                                            <item name="sortOrder"
                                                xsi:type="string">0</item>
                                            <item name="children"
                                                xsi:type="array">
                                                <!--add here child component declaration for your step-->
                                                <!-- authentication component should go here -->
                                            </item>
                                        </item>
                                    </item>
                                </item>
                            </item>
                        </item>
                    </item>
                </argument>
            </arguments>
        </referenceBlock>
        <move element="checkout.root.jsLayout.components.checkout.children.authentication"
destination="checkout.root.jsLayout.components.checkout.children.steps.children.custom-step.children" />
    </body>
</page>

but that doesn't seem to work. Is this possible?

1 Answer 1

0

It is possible by copying/pasting the original XML, you can't use the move instruction to achieve this.

To remove the original component you can use the following XML:

<item name="config" xsi:type="array">
    <item name="componentDisabled" xsi:type="boolean">true</item>
</item>

Managing UI components via XML a pain in the...

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.