Magento 2 – Remove Sidebar from Checkout

checkoutmagento2onepage-checkoutxml

I'd like to remove the sidebar from the onepage checkout in magento 2 as defined in checkout_index_index

<item name="sidebar" xsi:type="array">
    <item name="sortOrder" xsi:type="string">50</item>
    <item name="component" xsi:type="string">Magento_Checkout/js/view/sidebar</item>
    <item name="displayArea" xsi:type="string">sidebar</item>
    <item name="config" xsi:type="array">
        <item name="template" xsi:type="string">Magento_Checkout/sidebar</item>
        <item name="deps" xsi:type="array">
            <item name="0" xsi:type="string">checkout.steps</item>
        </item>
    </item>
   <item name="children" xsi:type="array">
......

I thought it would just be a case of deleting the xml but if I do that I get PHP errors telling me the sidebar index is undefined. Does anyone know of a way I can get rid of this without just hiding it with CSS/templates? or will it be a case of completely re-writing the checkout module? Thank you in advance.

Best Answer

If you want to remove UI component form layout xml, you have to disable it like

Replace this code

<item name="component" xsi:type="string">Magento_Checkout/js/view/sidebar</item>

By

<item name="componentDisabled" xsi:type="string">Magento_Checkout/js/view/sidebar</item>

Clear cache by : php bin/magento cache:clean

Note : do not modify core layout file, you have to override by your theme layout. this is only for reference how can we disable any layout component.

Let me know if you have any difficulty.