cancel
Showing results for 
Search instead for 
Did you mean: 

Overriding Magento\Catalog\Model\Layer\FilterList

Overriding Magento\Catalog\Model\Layer\FilterList

Hi There!

 

I'm trying to override Magento\Catalog\Model\Layer\FilterList class.

 

My vendor\module\etc\di.xml:

 

 

<preference for="Magento\Catalog\Model\Layer\FilterList" type="\vendor\module\Model\Layer\FilterList"/>
 
   
    <type name="Magento\Catalog\Model\Product">
        <plugin name="logProductName" type="\vendor\module\Plugin\ProductName" />
    </type>

 

The plugin above works perfect. However, preference doesn't. The statement is ignored.

 

Please advise me on it. What am I missing?

 

Thanks!

 

 

1 REPLY

Re: Overriding Magento\Catalog\Model\Layer\FilterList

You have mistakes in type class, 

Remove prefix \ from class rewrite defination

 

<preference for="Magento\Catalog\Model\Layer\FilterList" type="Vendor\Modulename\Model\Layer\FilterList" /> 

 remove var folder and clear cache.

 

Check changes in your site.

 

Thanks.

If Issue Solved, Click Kudos/Accept As solutions.