Posted on

Override third party module customerData class defined in di.xml arguments

I have a third party module that has this class

app/code/Vendor/ModuleName/CustomerData/Popup.php

and that class is defined in frontend/di.xml file like this

<type name=”MagentoCustomerCustomerDataSectionPoolInterface”>
<arguments>
<argument name=”sectionSourceMap” xsi:type=”array”>
<item name=”popup” xsi:type=”string”>VendorModuleNameCustomerDataPopup</item>
</argument>
</arguments>
</type>

I am trying to override the class “app/code/Vendor/ModuleName/CustomerData/Popup.php” as it has some protected methods.
I tried to use preferences in myVendor etc/di.xml file like

<preference for=”VendorModuleNameCustomerDataPopup” type=”MyVendorVendorModuleNameExtendRewriteVendorModuleNameCustomerDataPopup”/>

But this is not working and on store front I get error on customerData.js.

Is there a way that I can override that third party module di.xml or class and replace my own with argument->item my own class?

Leave a Reply

Your email address will not be published.