How can I replace the minicart icon when using a custom theme?
3 Answers
Try something like this in your .css:
.minicart-wrapper a.action.showcart::before {
content: "*whatever content you want, for example Font Awesome*";
}
You can also use a background-image
.
Here's how to include CSS in your theme: https://devdocs.magento.com/guides/v2.2/frontend-dev-guide/css-topics/css-themes.html
It depends on your theme. If this is a standard theme(luma), then you need to change the styles in the .css file. For the selector .minicart-wrapper .action.showcart::before
.
::First let me clear that you can't edit magento core themes directly from /app/design/magento!!!::
::If you want to change it your self then, you've to create your own one and make changes as required!!::
::Now let's go to the point!::
::first => Create custom.css file at /app/design/vendor/theme/Magento_Theme/web/css/
::
::second => create default.xml file at /app/design/vendor/theme/Magento_Theme/layout/
::
::Now put the file contents like below::
::CSS::
::
.minicart-wrapper .action.showcart:before{
content:url('../images/minicart.jpg')!important;
zoom:1.5%;
}
::
::XML::
<head>
<css src="Magento_Theme::css/custom.css"/>
</head>
//make sure to copy the default structure for xml file.
//I have not pasted that here because i am a noob to stackexchange!!
:::Last Step :::
move your new minicart image to the /app/design/vendor/theme/Magento_Theme/web/images/minicart.img extension
::Finally run below commands::
::Make sure to remove /pub/static/frontend::
::bin/magento setup:upgrade
::
::bin/magento setup:di:compile
::
::bin/magento setup:static-content:deploy -f
::
::bin/magento indexer:reindex
::
::bin/magento cache:flush
::
::chmod -R 777 ../magento root directory name
::
::Thank You::