I am override the minicart,

Source : vendor\magento\module-checkout\view\frontend\web\template\minicart\item\default.html

My code :


<div class="custom-photo">
            <!-- ko if: product_has_url -->
            <a data-bind="attr: {href: product_url, title: product_name}" tabindex="-1" class="product-item-photo">
                <!-- ko foreach: $parent.getRegion('itemImage') -->
                <!-- ko template: {name: getTemplate(), data: item.product_image} -->
                <!-- /ko -->
                <!-- /ko -->
            <!-- /ko -->
            <!-- ko ifnot: product_has_url -->
            <span class="product-item-photo">
                <!-- ko foreach: $parent.getRegion('itemImage') -->
                <!-- ko template: {name: getTemplate(), data: item.product_image} -->
                <!-- /ko -->
                <!-- /ko -->
            <!-- /ko -->

            <a href="#" data-bind="attr: {'data-cart-item': item_id, title: $t('Remove item')}"
                class="action remove-btn">
                <span data-bind="i18n: 'Remove'"></span>

If i click the remove link url added "#".

1 Answer 1


You have overridden template , but that needs to call in xml file like below then and then whole minicart functionality will work.

You need to create xml file in your modules as per below.

Please create file checkout_cart_sidebar_item_renderers.xml under path app/code/Zero/MinicartQty/view/frontend/layout

Now need to call your overridden template same as below.

<?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">
        <referenceBlock name="minicart">
                <argument name="jsLayout" xsi:type="array">
                    <item name="components" xsi:type="array">
                        <item name="minicart_content" xsi:type="array">
                            <item name="children" xsi:type="array">
                                <item name="item.renderer" xsi:type="array">
                                    <item name="config" xsi:type="array">
                                        <item name="displayArea" xsi:type="string">defaultRenderer</item>
                                        <item name="template" xsi:type="string">Zero_MinicartQty/minicart/item/default</item>

Now your minicart will work properly.

  • Can you please approve my answer as well so it will be helpful for others too. Thanks
    – ZealousWeb
    Apr 20, 2021 at 4:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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