Create etc/frontend/di.xml
<type name="\Magento\Bundle\Block\Catalog\Product\View\Type\Bundle\Options">
<plugin name="Custom_Module::aftershowSingle"
type="Custom\Module\Plugin\Block\Catalog\Product\View\Type\Bundle\Options"
sortOrder="10" />
</type>
Then create a plugin in your custom module and override path in your module and implement code as your functionality
<?php
/**
namespace Custom\Module\Plugin\Block\Catalog\Product\View\Type\Bundle;
class Option
{
/**
* @var \Magento\Framework\Registry
*/
protected $_registry;
/**
* @param \Magento\Framework\Registry $registry
*/
public function __construct(
\Magento\Framework\Registry $registry
) {
$this->_registry = $registry;
}
/**
*
* @param array $result
*
* @return bool
*/
public function aftershowSingle(
\Magento\Catalog\Model\ResourceModel\Product\Collection $collection,
$result
) {
if ($this->_registry->registry('mp_flat_catalog_flag')) {
$result = 0;
}
return $result;
}
}
I just override showsingle method.
Note
• Plugins only work on public methods.
• They do not work on final methods, final classes.
• They must be configured in di.xml.
Important: plugins can be used on interfaces, abstract classes or parent classes. The plugin methods will be called for any implementation of those abstractions.