3

I need to customize Magento_Checkout module.

I have tried to copied that html files into my theme path but the override is not working

Override path mentioned in below

/app/design/frontend/Vendor/ThemeName/Magento_Checkout/web/template

But the file is taken from

/vendor/magento/module-checkout/view/frontend/web/template

How to override this template html files?

5
  • Not working for me as well as trying to override app\design\frontend\Magento\luma\Magento_Theme\templates\root.phtml Home Page Why?
    – Jackson
    Commented Sep 27, 2016 at 10:06
  • Deeban do you mean the Knockout html files? Or do you mean phtml files? Commented Sep 27, 2016 at 10:08
  • He is overriding Knockout HTML files & I'm trying phtml files
    – Jackson
    Commented Sep 27, 2016 at 10:10
  • Cool, I've posted an answer for both html and phtml files. Commented Sep 27, 2016 at 10:19
  • your path is correct you need to remove cache of browser and remove pub/static folder from root and run command for deployment Commented Sep 27, 2016 at 10:50

2 Answers 2

4

I'll post the answer for both phtml and html files.

Overriding phtml files

For example if you want to override site_name/vendor/magento/module-checkout/view/frontend/templates/cart/shipping.phtml, you will need to put it under /site_name/app/design/frontend/ThemeName/default/Magento_Checkout/templates/cart/shipping.phtml

Overriding (KO) html files

For example if you want to override /site_name/vendor/magento/module-checkout/view/frontend/web/template/summary/item/details.html, you will need to put it under/site_name/app/design/frontend/ThemeName/default/Magento_Checkout/web/template/summary/cart-items.html

Now html pages can be a hassle, you need to make sure the caches from your browser are cleared. If you're using the latest google chrome you can inspect element go to network tab and then tick disable caches, reload the page. Reason for this is that HTML pages are more cacheable. If this does not work clear you pub/static/frontend folder.

19
  • Nope still not working. I have done above things & I also run php bin/magento setup:static-content:deploy & clear cache still not working.
    – Jackson
    Commented Sep 27, 2016 at 10:24
  • Does anything else work under your theme? Commented Sep 27, 2016 at 10:26
  • Didn't check, but trying to override homepage it should work right?
    – Jackson
    Commented Sep 27, 2016 at 10:27
  • It should work, maybe you missed something. Have you registered the theme? Commented Sep 27, 2016 at 10:28
  • 1
    This is what you have to do to override a HTML file magento.stackexchange.com/a/117236/55149
    – Char
    Commented Apr 18, 2018 at 14:28
0

If you want to override the html file in Magento 2.1 then you need to follow few instructions :

1: Copy html file from /Vendor/magento/module-catalog/web/template and paste in your theme (target directory) /app/design/frontend/vendor-name/theme-name/magento_catalog/web/template

2: Delete the pub/static and var from root directory:

rm -rf pub/static/*
 rm -rf var/*

3: Deploy by SSH command:

 php bin/magento setup:static-content:deploy

4: Refresh the page.

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.