Magento – Magento 2 breadcrumbs issue on product view page

breadcrumbsmagento2

I have been facing one issue with breadcrumbs in Magento 2.2.3 CE i.e As per our observation, when the user browses the product from the category page, for some products breadcrumb full path is displaying on the view page.

home -> main category -> sub category -> Name of the product

https://prnt.sc/m5sly9

For some products product name only displaying home -> Name of the product

https://prnt.sc/m5smah

Can anyone please suggest and know the reason why it is happening?

Best Answer

Go to Admin > Stores > Configuration > Catalog > Catalog > Search Engine Optimization > Set "Yes" for Use Categories Path for Product URLs option.

enter image description here

You need to reindex after configure this setting and need to flush cache.

Please check and accept the answer if it's helpful.

Now add below code just after body tag in catalog_product_view.xml

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

Now just override below file into your current theme.

vendor/magento/module-theme/view/frontend/templates/html/breadcrumbs.phtml

Clean cache after that and check again.

Related Topic