1

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.

1

3 Answers 3

-2

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.

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

Sidebar is item name that you want to remove Change this with your item name.

0

To remove sidebar from checkout page. Add below entry in default.xml

 <referenceBlock name="div.sidebar.additional" remove="true"/>

To remove sidebar from success page. Add below entry in checkout_onepage_success.xml

 <referenceContainer name="content">
      <referenceBlock name="catalog.leftnav" remove="true"/>
  </referenceContainer >

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.