Magento 2: How to override mini-cart default template html file?
first we have to override web/template files to our magento theme file, in my case content.html
Magento_Checkout/web/template/minicart/content.html
After changes in content.html
file, we have to deploy static file using command php bin/magento setup:static-content:deploy
OR
You have to delete content.html(i have to change content in this file) file from pub/static/frontend/Magento/buytea/en_US/Magento_Checkout/template/minicart
and reload page again.
Changes are applied.
There is another way. We should know that we can override the html template via RequireJS. We don't need to create a custom theme. In your custom module, create a requirejs-config.js
:
app/code/{Vendor}/{Module_Name}/view/frontend/requirejs-config.js
var config = {
map: {
'*': {
'Magento_Checkout/template/minicart/content.html':
'Vendor_ModuleName/template/minicart/content.html'
}
}
};
A more explain we can read more here.
You can override this by adding this folder to your theme:
Magento_Checkout/web/template/minicart
In this folder you can create the content.html file. After a change made in this file make sure you flush your browser cache to see the changes.