Magento – Magento 2 – How to re-add footer on checkout page after it’s removed by default before

checkoutlayoutmagento2

I'm trying to re-add footer on checkout page after it's has been removed from Magento 2 Blank Theme:

magento/theme-frontend-blank/Magento_Checkout/layout/checkout_index_index.xml

<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="minicart" remove="true"/>
        <referenceContainer name="header.panel" remove="true"/>
        <referenceBlock name="top.search" remove="true"/>
        <referenceBlock name="catalog.compare.link" remove="true"/>
        <referenceBlock name="catalog.topnav" remove="true"/>
        <referenceContainer name="footer-container" remove="true"/>
    </body>
</page>

I'm tried to overide on my theme:
Mystore/mytheme/Magento_Checkout/layout/checkout_index_index.xml

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="footer-container" remove="false"/>
    </body>
</page>

But it didn't working, anyone can help?

Best Answer

Previous solution didn't work for me, so I found another.

In Magento 2 checkout page uses custom layout, placed in
vendor/magento/module-checkout/view/frontend/page_layout/checkout.xml

So, you need to replace it with any other layout (for example, to 1column).

Go to vendor/magento/module-checkout/view/frontend/layout and copy the file checkout_index_index.xml to your theme (without the declarations inside the <body>).

Then change this line:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="checkout" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

to

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

Then remove the header in the regular way.

Related Topic