Magento2: breadcrumbs disappeared from product page after upgrading to 2.2.4

I found the same problem and did it little bit easier and without ObjectManager. I found out the way how it's done with categories and used that. In catalog_product_view.xml, I rewrite template back to Magento_Theme's one:

<referenceBlock name="breadcrumbs" template="Magento_Theme::html/breadcrumbs.phtml" />

Then I wrote small plugin:

namespace Vendor\Module\Plugin\Catalog\Block\Product;

class View
{

    /**
     * Add Breadcrumbs Block
     *
     * @param \Magento\Catalog\Block\Product\View $subject
     * @param $result
     * @return mixed
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function afterSetLayout(\Magento\Catalog\Block\Product\View $subject, $result) {
        $subject->getLayout()->createBlock(\Magento\Catalog\Block\Breadcrumbs::class);

        return $result;
    }
}

Finally, di.xml:

<type name="Magento\Catalog\Block\Product\View">
    <plugin name="add_catalog_breadcrumb_block" type="Vendor\Module\Plugin\Catalog\Block\Product\View" />
</type>

Two problems have been fixed: missing breadcrumbs and missing page title (in head section) in the product page.


These two lines restores the class breadcrumb block. That's it. No custom plugins or something else:

<referenceBlock name="breadcrumbs" template="Magento_Theme::html/breadcrumbs.phtml" />
<block class="Magento\Catalog\Block\Breadcrumbs" />

For the ones who wants a Fix Module until Magento fixes this:

https://github.com/CompactCodeEU/FixProductBreadcrumbs.git

I created this to add the home and product to the breadcrumb. Also this prevents the JS from executing since i replace it by the default html.