Skip to main content

I have override two core checkout xml filefiles for overrideoverriding default.phtml file in magento 2 as as per the ref url -

   Overriding template not working in Magento 2

But when I add configurable product into my cart, then its global attributes like color and size are not visible on cart page.

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_index.xml

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock class="Magento\Checkout\Block\Cart" name="checkout.cart.form">
            <block class="Magento\Framework\View\Element\RendererList" name="checkout.cart.item.renderers.override" as="renderer.list.custom"/>
            <arguments>
                <argument name="renderer_list_name" xsi:type="string">checkout.cart.item.renderers.override</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.cart.item.renderers.override">

            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="XYZ_Checkout::cart/item/default.phtml" />              

            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="simple" template="XYZ_Checkout::cart/item/default.phtml" />   

        </referenceBlock>
    </body>
</page>

I have override two core checkout xml file for override default.phtml file in magento 2 as per ref url -

 Overriding template not working in Magento 2

But when I add configurable product in my cart, then its global attributes like color and size are not visible on cart page.

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock class="Magento\Checkout\Block\Cart" name="checkout.cart.form">
            <block class="Magento\Framework\View\Element\RendererList" name="checkout.cart.item.renderers.override" as="renderer.list.custom"/>
            <arguments>
                <argument name="renderer_list_name" xsi:type="string">checkout.cart.item.renderers.override</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.cart.item.renderers.override">

            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="XYZ_Checkout::cart/item/default.phtml" />              

            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="simple" template="XYZ_Checkout::cart/item/default.phtml" />   

        </referenceBlock>
    </body>
</page>

I have override two core checkout xml files for overriding default.phtml file in magento 2 as per the ref url -  Overriding template not working in Magento 2

But when I add configurable product to my cart, then its global attributes like color and size are not visible on cart page.

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock class="Magento\Checkout\Block\Cart" name="checkout.cart.form">
            <block class="Magento\Framework\View\Element\RendererList" name="checkout.cart.item.renderers.override" as="renderer.list.custom"/>
            <arguments>
                <argument name="renderer_list_name" xsi:type="string">checkout.cart.item.renderers.override</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.cart.item.renderers.override">

            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="XYZ_Checkout::cart/item/default.phtml" />              

            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="simple" template="XYZ_Checkout::cart/item/default.phtml" />   

        </referenceBlock>
    </body>
</page>
Source Link
Nitz
  • 449
  • 1
  • 7
  • 21

Magento 2 configurable product cart item override issue

I have override two core checkout xml file for override default.phtml file in magento 2 as per ref url -

Overriding template not working in Magento 2

But when I add configurable product in my cart, then its global attributes like color and size are not visible on cart page.

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_index.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock class="Magento\Checkout\Block\Cart" name="checkout.cart.form">
            <block class="Magento\Framework\View\Element\RendererList" name="checkout.cart.item.renderers.override" as="renderer.list.custom"/>
            <arguments>
                <argument name="renderer_list_name" xsi:type="string">checkout.cart.item.renderers.override</argument>
            </arguments>
        </referenceBlock>
    </body>
</page>

app/code/XYZ/Checkout/view/frontend/layout/checkout_cart_item_renderers.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="checkout.cart.item.renderers.override">

            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="default" template="XYZ_Checkout::cart/item/default.phtml" />              

            <block class="Magento\Checkout\Block\Cart\Item\Renderer" as="simple" template="XYZ_Checkout::cart/item/default.phtml" />   

        </referenceBlock>
    </body>
</page>