0

Wondering how to remove sidebar from topl level category list page that parent is Default Category through code not admin panel? Considering after setting template categories are going to be created, so no info about their ids.

0

You need to create separate xml file for all of your top level category by below way.

catalog_category_view_id_{idnumber}

If your category with id is 3 then catalog_category_view_id_3 and keep this file inside your module or theme level.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="sidebar.main" remove="true" />
    </body>
</page>
| improve this answer | |
  • I was aware about this solution. But how bout if later customer add new main category? Is there any more general way? thanks (I edited my question to address this specification) – Zinat Sep 27 '17 at 8:44

Your Answer

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

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