I have Magento 2.2.4 version, And I want to overwrite Magento_Checkout/template/minicart/item/default.html file in my custom module. For this, I created require-jsconfig.js file at below path


var config = {
    map: {
        '*': {
          'Magento_Checkout/template/minicart/item/default.html': 'Namespace_Module/template/minicart/item/default.html'

removed "var" folder from root and remove "pub/static/frontend" folder and run below command:

php bin/magento setup:static-content:deploy

But mini cart is showing blank. Can anyone help me to understand my mistake?

2 Answers 2


Magento provides requirejs-config.js files for overriding the js & html file to enhance the functionality of the existing js & html files by simply manipulating them into your custom module.

To do that just follow the following guidelines.

  • Create & register your custom module & create requirejs-config.js file at below location


And below code in your requirejs-config.js

var config = {
    map: {
        '*': {

If you required to do very minor changes then instead of creating a module you can directly do that by simply overriding it with the help of your theme. For that just follow the below guidelines.

  • Just copy the file from the below location


  • Place it into your custom theme at the below location & make your changes there into that file


So we can override any html file in this way.

Note: After making the changes to deploy it properly please run the below commands

php bin/magento setup:upgrade
php bin/magento setup:static-content:deploy -f
php bin/magento c:f                     
  • 1
    I tried to overwrite through requirejs-config.js not working Commented Mar 6, 2019 at 10:15
  • Did you checked that is it calling your page or the default old page there in your cart section? try to make different changes into both of them & see which change is coming there. try to deploy your static content & before that delete the generated folder & the var/cache folder contents. Commented Mar 6, 2019 at 10:20
  • After doing that I checked, it is calling the default file only. Not the updated one. But I can able to see my updated code under pub/static section. And I run below all command rm -rf pub/static/frontend/ , rm -rf var/, rm -rf generated/, php bin/magento setup:upgrade, php bin/magento setup:di:compile, php bin/magento setup:static-content:deploy, php bin/magento indexer:reindex, php bin/magento cache:clean, php bin/magento cache:flush Commented Mar 6, 2019 at 11:05
  • Are you working on your local system or on the server? If you are working on the server then there is a possibility that some cache is set there try to remove that cache & also try with different browsers or browsers into incognito/safe mode because it can be possible that your browser cache is loading the old data! Commented Mar 6, 2019 at 11:25
  • I am working on a server and open site in incognito/safe mode only Commented Mar 6, 2019 at 11:27

You can also check xml file here


in line 27

<item name="template" xsi:type="string">Magento_Checkout/minicart/item/default</item>

You have to create same file in your module vendor/module/view/frontend/layout/checkout_cart_sidebar_item_renderers.xml and add this content to it

<?xml version="1.0"?>
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
<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="template" xsi:type="string">vendor_module/minicart/item/default</item>

Your Answer

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

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