I've been battling with this one for a while but can't figure out how to disable, in order to override, a plugin in the Amasty Shop by extension. I need to override a couple of methods in the plugin, but as they're set to private and use private variables declared within the class, I think I have to just disable that specific plugin and override it with my own.
The issue I have is that the plugin doesn't appear to be declared/named in the di.xml files present in the extension, but there are some additional plugins in the extension which extend it, and these plugins are named in di.xml.
The plugin I am trying to override is here:
There are 2 plugins (in the same directory as the above) which extend it, and are named in
vendor/amasty/shopby/etc/frontend/di.xml as below:
<type name="Magento\Catalog\Controller\Category\View"> <plugin name="Amasty_Shopby::ajaxInject" type="Amasty\Shopby\Plugin\Ajax\CategoryViewAjax"/> </type>
I've created and registered my module, and my attempt to disable and override the plugin is as follows:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Amasty\Shopby\Plugin\Ajax\Ajax"> <plugin name="Amasty\Shopby\Plugin\Ajax\Ajax" disabled="true" /> <plugin name="my_ajax" type="MyNamespace\Shopby\Plugin\Ajax\Ajax" /> </type> </config>
It's likely I'm missing something obvious here, grateful for any pointers in the right direction.