2

How to remove catalog.leftnav from Only Non Anchored Category page. I have to required catalog.leftnav in Anchored category page only.

I have done code for that, file path, app/design/frontend/Package/theme/Magento_Catalog/layout/catalog_category_view_type_default.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
            <referenceBlock name="catalog.leftnav" remove="true"/>                
    </body>
</page>

But Above code remove left sidebar from Anchor category page also.

  • can you move this code to default.xml? – Sohel Rana Jun 20 '16 at 7:33
3

i know this post is old, but i found a simple solution.

go to Backend > Products > Categories chose the category you want to remove catalog.leftnav from

then go to Design tab, inside Layout Update XML put <referenceContainer name="catalog.leftnav" remove="true"/>

this should remove catalog.leftnav from that category only.

0

Your code is totally right, you need to change the name of your file from:

catalog_category_view_type_default.xml

To:

catalog_category_view_type_default_without_children.xml
  • I have try using above file not working yet. – Rakesh Jesadiya Jun 20 '16 at 7:44
  • my code is working fine, i have blank subcategory in anchor category. so issue is blank category. – Rakesh Jesadiya Jun 20 '16 at 8:33

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.