0

Following this answer and slightly editing the LayoutProcessorPlugin I managed to get the billing-address form in the shipping-address form.

But it is shown beneath the e-mail adress input, and above all other fields. I want it below all other fields. current situation

So I figured XML is the way to go so I added this to my checkout_index_index.xml file:

    <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">
                                    <item name="shipping-step" xsi:type="array">
                                        <item name="children" xsi:type="array">
                                            <item name="children" xsi:type="array">
                                                <item name="shippingAddress" xsi:type="array">
                                                    <item name="children" xsi:type="array">
                                                        <item name="shipping-address-fieldset" xsi:type="array">
                                                            <item name="children" xsi:type="array">
                                                                <item name="billing-address-form" xsi:type="array">
                                                                    <item name="sortOrder" xsi:type="string">150</item>
...

My setup in the LayoutProcessorPlugin is as follows;

$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']['shippingAddress']['children']['shipping-address-fieldset']['children']['billing-address-form'] = $billingAddressForm;

and my di.xml is as follows:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
        <plugin name="reorder-billing-form" type="Vendor\Module\Model\Checkout\LayoutProcessorPlugin" sortOrder="150"/>
    </type>
</config>

But the field either shows next to the email input, or not at all if I change anything. Does anyone know where I'm going wrong?

Your Answer

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

Browse other questions tagged or ask your own question.