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:

  1. Create the Magento_Catalog directory under the compstore theme directory.
  2. Copy the contents of vendor/magento/module_catalog/view/frontend/templates to app/design/frontend/Packt/compstore/Magento_Catalog/templates.
  3. Then, open the app/design/frontend/Packt/compstore/Magento_Catalog/templates/product/view/addto.phtml file in your favorite code editor.
  4. Go to Line 17 and enter the following code:
    <div><h2>Buy in CompStore!!!</h2></div>
  5. Save the file.
  6. 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.