I have tried to add breadcrumbs on product category page and also on product details page with following codes but it's not working.

1. Add following code to theme default.xml and check page.top is not remove

<referenceContainer name="page.top">
                <block class="Magento\Theme\Block\Html\Breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>

2. add fallowing code to catalog_category_view.xml

<referenceBlock name="breadcrumbs">
            <action method="addCrumb">
                <argument name="crumbName" xsi:type="string">Home</argument>
                <argument name="crumbInfo" xsi:type="array">
                    <item name="title" xsi:type="string">Home</item>
                    <item name="label" xsi:type="string">Home</item>
                    <item name="link" xsi:type="string">{{baseUrl}}</item>
            <action method="addCrumb">
                <argument name="crumbName" xsi:type="string">Register</argument>
                <argument name="crumbInfo" xsi:type="array">
                    <item name="title" xsi:type="string">Register</item>
                    <item name="label" xsi:type="string">Register</item>

3. Add following code to list.phtml

<?php echo $this->getLayout()->getBlock('breadcrumbs')->toHtml(); ?>

All above codes are not working.

  • Please check option already available at the config side 1.Log into your Magento Admin Panel with your username and password 2.Navigate to System/ Configuration/ Web/ Default Pages 3. In Show Breadcrumbs for CMS Pages, choose yes to get Breadcrumbs disabled – Birjitsinh Zala Jul 19 '18 at 11:16
  • Yes i have check it but its not working – Sarvesh Tiwari Jul 19 '18 at 12:39

Please add into your layout file

<referenceBlock name="breadcrumbs" template="Magento_Catalog::product/breadcrumbs.phtml">
                <argument name="viewModel" xsi:type="object">Magento\Catalog\ViewModel\Product\Breadcrumbs</argument>
| improve this answer | |
  • Thanks Bro but its not working for me – Sarvesh Tiwari Jul 19 '18 at 12:40
  • I think yours answer for magento 1.9 not 2.2 – Sarvesh Tiwari Jul 19 '18 at 12:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.