free
web stats

Fill the form & Get Installation Support

We don't monkey around your business.

GET IN TOUCH WITH US NOW





captcha

Overriding Magento\Catalog\Model\Layer Model class in Magento 2

To customize the layered navigation in Magento 2, sometimes, we need to override the core class file. Generally, we can use preference to override models, but it’s not possible every time.

So on that case, we need to use a different approach and have to use virtualType to achieve that.

Please find below the steps to override models using virtualType.

1. Create an di.xml in : /app/code/Magemonkeys/LayerModel/etc

2. Create an FilterList.php in : /app/code/Magemonkeys/LayerModel/Model/Layer