8

I want to add breadcrumbs to the shopping cart page before the page title like this:

enter image description here

How can I achieve this.?

Thanks..!

14

Create a file app/design/frontend/vendor/theme/Magento_Checkout/layout/checkout_cart_index.xml

and add following code in checkout_cart_index.xml file

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="checkout_cart_item_renderers"/>
    <body>
        <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">/</item>
                </argument>
            </action>
            <action method="addCrumb">
                <argument name="crumbName" xsi:type="string">Shopping Cart</argument>
                <argument name="crumbInfo" xsi:type="array">
                    <item name="title" xsi:type="string">Shopping Cart</item>
                    <item name="label" xsi:type="string">Shopping Cart</item>
                </argument>
            </action>
        </referenceBlock>
    </body>
</page>
5

Overwrite in ur custom theme magento\vendor\magento\module-checkout\view\frontend\layout\checkout_cart_index.xml to magento\app\design\frontend\<Vendor>\<Theme_Name>\Magento_Checkout\layout\checkout_cart_index.xml & add

<body>
        <referenceBlock name="page.main.title" display="true"> // True/False
            <action method="setPageTitle">
                <argument name="title" translate="true" xsi:type="string">Shopping Cart</argument>
            </action>
        </referenceBlock>
        <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>
                </argument>
            </action>
            <action method="addCrumb">
                <argument name="crumbName" xsi:type="string">Shopping Cart</argument>
                <argument name="crumbInfo" xsi:type="array">
                    <item name="title" xsi:type="string">Shopping Cart</item>
                    <item name="label" xsi:type="string">Shopping Cart</item>
                </argument>
            </action>
        </referenceBlock>
</body>
  • Thanks for your answer. Your answer is much better than accepted answer and it resolves my issue. – Ashish Jagnani Feb 27 '18 at 6:53

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.