I would link to remove all the layered navigation filters from left side of Magento 2
, using xml
Please guide me
5 Answers
Add this to your theme default.xml
<referenceBlock name="catalog.leftnav" remove="true" />
OR
Add this on Admin Panel > Products > Categories > YOUR PAGE > Design
<referenceContainer name="catalog.leftnav" remove="true" />
You can do this by just admin category settings.
In admin panel of your Magento, go to Products > Categories
, then select the category on the left.
Now on the right side, select Display Settings
tab, and from the settings that appear make sure that the Is Anchor
option is set to No
.
Do this for all categories you want to hide Layered navigation from. Clear Cache and do re-index if required.
To remove layered navigation from search
<referenceBlock name="catalogsearch.leftnav" remove="true" />
To remove this via Layout Update XML in the CMS (Products > Categories > Design
) use
<referenceContainer name="catalog.leftnav" remove="true" />
Note it has to be referenceContainer
and not referenceBlock
when used here.
Well you could remove it's 'module' completely altogether from the system without any tweaking:
NOTE: Please be extremely careful with this procedure, as it can break things, if it does, then please check my last comment-line below to restore.
1) Go to the command line, where Magento is.
2) run:
php bin/magento module:uninstall Magento_LayeredNavigation
3) Confirm (Yes, Yes,... )
4) Remove the old cache/and generated content:
rm -rf var/cache/* pub/static/frontend generated/code/*
5) Re-Index:
php bin/magento index:reindex
6) Clear the cache:
php bin/magento index:reindex
4) If needed, clear the cache and refresh.
if you miss it, and want it back, or if removing causes problems, then re-enable it using:
php bin/magento module:enable Magento_LayeredNavigation
I hope this helps.
Regards Heider
-
Would it be preferable to disable the module with
php bin/magento module:disable Magento_LayeredNavigation
rather than removing it?– gnickoCommented May 11, 2022 at 14:18