1.4 (27.57%) 37 votes
Override a Template File in Magento 2
Override a Template File in Magento 2
  • For example : we override template file of checkout/cart/index controller page.
  • Create checkout_cart_index.xml in app/code/[Name_Space]/[Your_Module]/view/frontend/ layout

  • checkout.cart : is block name, whose template file you want to override.
  • [Name_Space]_[Your_Module]::checkout_cart.phtml : is a template file of your module.
  • Create checkout_cart.phtml file in app/code/[Name_Space]/[Your_Module]/view/frontend/templates

The steps I mention above is the shortest process for you to Override a Template File in Magento 2. With this guide, you can manage the Template File in Magento 2 easily. Every store has a Template File in Magento 2 with many attributes.

Thank you for reading this post and see you in other posts from Magestore!

 

Your Magento website needs a powerful Magento ERP for stock control.

DON'T MISS THE CHANCE!

magento erp

How to Use all Commands in Magento 2 CLI (Part 9) - Magento 2.3
How to Switch among Multiple Websites in Magento 2 - Magento 2.3