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?

  • Not working for me as well as trying to override app\design\frontend\Magento\luma\Magento_Theme\templates\root.phtml Home Page Why? – Ankit Shah Sep 27 '16 at 10:06
  • Deeban do you mean the Knockout html files? Or do you mean phtml files? – André Ferraz Sep 27 '16 at 10:08
  • He is overriding Knockout HTML files & I'm trying phtml files – Ankit Shah Sep 27 '16 at 10:10
  • Cool, I've posted an answer for both html and phtml files. – André Ferraz Sep 27 '16 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 – Rakesh Jesadiya Sep 27 '16 at 10:50
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.

  • Nope still not working. I have done above things & I also run php bin/magento setup:static-content:deploy & clear cache still not working. – Ankit Shah Sep 27 '16 at 10:24
  • Does anything else work under your theme? – André Ferraz Sep 27 '16 at 10:26
  • Didn't check, but trying to override homepage it should work right? – Ankit Shah Sep 27 '16 at 10:27
  • It should work, maybe you missed something. Have you registered the theme? – André Ferraz Sep 27 '16 at 10:28
  • 1
    This is what you have to do to override a HTML file magento.stackexchange.com/a/117236/55149 – Char Apr 18 '18 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, privacy policy and cookie policy

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