Skip to content

disable a virtual class from custom module

I know how I can disable the type aka plugin class but I don’t know how to disable the Virtual class.

I have a the following Virtual class in a 3rd party extension. I don’t want to edit their code which reside in vendor directory. (Not a good approach). I have created my custom extension where I need to disable the following code.

<virtualType name="elasticsearchLayerSearchItemCollectionProvider" type="MagentoElasticsearchModelLayerSearchItemCollectionProvider">
    <arguments>
        <argument name="factories" xsi:type="array">
            <item name="elasticsearch7" xsi:type="object">spdElasticsearchFulltextSearchCollectionFactory</item>
            <item name="elasticsearch8" xsi:type="object">spdElasticsearchFulltextSearchCollectionFactory</item>                      
            <item name="opensearch" xsi:type="object">spdElasticsearchFulltextSearchCollectionFactory</item>
        </argument>
    </arguments>
  </virtualType>

I want to disable the elasticsearchLayerSearchItemCollectionProvider