Customizing Magento 2.0 templates
Magento works with .phtml
template files to generate the view layer for the users. The modules and themes in Magento have its specific group of .phtml
files to show data to the users. Let's create a custom template example in the CompStore theme to see how it works:
- Create the
Magento_Catalog
directory under thecompstore
theme directory. - Copy the contents of
vendor/magento/module_catalog/view/frontend/templates
toapp/design/frontend/Packt/compstore/Magento_Catalog/templates
. - Then, open the
app/design/frontend/Packt/compstore/Magento_Catalog/templates/product/view/addto.phtml
file in your favorite code editor. - Go to Line 17 and enter the following code:
<div><h2>Buy in CompStore!!!</h2></div>
- Save the file.
- Delete the ...
Get Magento 2 - Build World-Class online stores now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.