free
web stats

Fill the form & Get Installation Support

Connect With Us





captcha

Connect With Us





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

Was this article helpful?
YesNo
Fill the below form if you have any Magento programming need.




captcha