0

This is the Magento core template path:

vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml

I would like know how to override this template with my theme.

Riyas Muhammed
  • 1,053
  • 4
  • 19
  • 34

2 Answers2

1

Simple copy minicart.phtml from following

vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml

and put in

root/app/design/VenderName/ThemeName/Magento_Checkout/templates/cart/minicart.phtml

Flush your cache and check.

Kaushal Suthar
  • 3,227
  • 5
  • 31
  • 57
  • figure out the structure, Checkout is a Magento module it will be override like as theme override(Magento_Theme): Core: vendor\magento\module-theme\view\frontend\ Override: <vendor-name>\<theme-name>\Magento_Theme\

    So Checkout(Magento_Checkout): Core: vendor\magento\module-checkout\view\frontend\ Override: <vendor-name>\<theme-name>\Magento_Checkout\

    minicart.phtml will be placed accordingly: <magento-root>/app/design/frontend/<vendor-name>/<theme-name>/Magento_Checkout/templates/cart/minicart.phtml

    So like this method any modules template can be override and customize.

    – Riyas Muhammed Sep 14 '16 at 13:31
  • Yes............. – Kaushal Suthar Sep 14 '16 at 13:48
  • I did the same for same file but it didnt worked. And debug mode displaying same file ie. /path-to-root/vendor/magento/module-checkout/view/frontend/templates/cart/minicart.phtml

    and i cleard cache manually as well as with command: php bin/magento cache:flush though cache is already disabled. -- whats wrong with it?

    – Jarnail S Nov 25 '16 at 07:03
  • @jai : Did you tried after generating static contents?? – Kaushal Suthar Nov 25 '16 at 09:54
  • Yes. [1] I created file [2] deployed [3] flushed cahce. I also tried same for list.phtml (/path/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml) but it also didnt work. really odd becasue i did following all guidelines. My magento version: 2.1.2 – Jarnail S Nov 25 '16 at 09:59
  • Its so simple but i dont know why its not working – Jarnail S Nov 25 '16 at 10:01
  • I tried with another .phtml override. Here its: [1] Copy from /vendor/magento/module-wishlist/view/frontend/templates/link.phtml to /app/design/frontend//<theme-name‌​>/module-wishlist/view/frontend/templates/link.phtml (there is no other file in module-wishlist directory in my theme)[2] php bin/magento setup:static-content:deploy [3] php bin/magento cache:flush [4] Also manually deleted cache from PUB(except .htaccess) and VAR/view_preprocessed.... But in debug mode this .phtml file still diplaying from /vendor/magento/module-wishlist/view/frontend/templates/link.phtml. – Jarnail S Nov 28 '16 at 07:47
  • I could not figure out where I am doing wrong. – Jarnail S Nov 28 '16 at 08:02
0

The only thing that worked was manually clearing the contents of pub/static/ but make sure that you don't delete the .htaccess file inside pub/static/ folder

Some of the things that I tried and didn't work

  1. Adding a mapping in requirejs-config.js (Both in the code and design folders)

    "map": {
        "*": {
            'Magento_Checkout/template/minicart/content.html': 'Magento_Theme/template/minicart/content.html'
        }
    } 
    
  2. bin/magento setup:static-content:deploy -f --theme Vendor/module en_GB en_US