cancel
Showing results for 
Search instead for 
Did you mean: 

How to override the CartRestorationfilter.java in storefront from custom addon?

Former Member
0 Kudos

I did some changes in CartRestorationfilter which is present in storefront and now i dont want these changes present in my storefront i would like to move the cartRestorationFilter to my custom addon.Is it possible?Any help is much appreciated

Accepted Solutions (0)

Answers (1)

Answers (1)

bhavirisetty
Active Participant
0 Kudos

Hi,

Try like below, in your storefront you can see some config like below,

 <bean id="cartRestorationFilter" class="com.rodanandfields.storefront.filters.CartRestorationFilter" >
     
 </bean>
 
 <alias name="defaultStorefrontTenantDefaultFilterChainList" alias="storefrontTenantDefaultFilterChainList" />
 <util:list id="defaultStorefrontTenantDefaultFilterChainList">
     

     <!-- filter to restore items in cart -->
     <ref bean="cartRestorationFilter"/>

     

 </util:list>
 
 change configuration like, 
 
 
 <alias name="cartRestorationFilter" alias="aliasRestorationCartFilter" />
 <bean id="cartRestorationFilter" class="com.rodanandfields.storefront.filters.CartRestorationFilter" >
     
 </bean>

 
 <alias name="defaultStorefrontTenantDefaultFilterChainList" alias="storefrontTenantDefaultFilterChainList" />
 <util:list id="defaultStorefrontTenantDefaultFilterChainList">
     

     <!-- filter to restore items in cart -->
     <ref bean="aliasRestorationCartFilter"/>

     

 </util:list>

 
 now you are using alias , so now in your addon define another bean and configure like below,

 <alias name="newCartRestorationFilter" alias="aliasRestorationCartFilter" />
     <bean id="newCartRestorationFilter" class="newclass" parent="cartRestorationFilter" >
     
 </bean>    

 
 now your addon aliasRestorationCartFilter bean  will override the storefornt bean 

Thanks