Magento 2 - Why upsell section is displaying bundle products?

I faced one strange issue, that is we didn't add any upsell rule and we didn't add any upsell products in the prodcut via admin. But somehow upsell section is displaying associated bundle products collection when we loaded simple product collection. After debugging, we found the below observer will add the bundle products in upsell section when it matches with getAllowedSelectionTypes.

<event name="catalog_product_upsell">
    <observer name="bundle_observer" instance="Magento\Bundle\Observer\AppendUpsellProductsObserver"/>
if (!in_array($product->getTypeId(), $this->bundleData->getAllowedSelectionTypes())) {
    return $this;

We can find the same observer in the Magento official GitHub codebase. I have checked the Magento official documentation and there are no clear updates about the above observer.

I found this known issue:

I feel this is the worst idea without giving any controls from admin, Magento added bundle products in the simple product upsell section. At least, it should be shown the added products in the admin upsell section. If you are looking to disable this feature, please create the below events.xml in your custom extension.

<?xml version="1.0"?>
<config xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:Event/etc/events.xsd">
    <!-- Disabling Default Observer Magento\Bundle\Observer\AppendUpsellProductsObserver -->
    <event name="catalog_product_upsell">
        <observer name="bundle_observer" disabled="true"/>

After that, run the needed Magento commands as setup upgrade, di-compile, static content deploy, cache flush.

I hope it helps! If you have any questions/suggestions, please mention them in the comment.

11 views0 comments

Recent Posts

See All