Web Analytics

Fill the form & Get Installation Support

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

Fill the below form if you have any Magento programming need.

    Recent Articles

    Author Info

    Author Image

    Magento 2 Developer

    Hire H. Shingala

    Get a Free Quote

      /* second popup */

      Connect With Us