Sometimes we need to make modifications to existing templates. Instead of making changes directly to existing template files, we should override them in our own theme.
Let us assume that we want to update the category listing page ( list.phtml
). To do so, create following directory structure:
app/design/frontend/Mycompany/Basic/Magento_Catalog/templates/product
Here I assume that our current theme is Basic. Now copy the list.phtml file into product directory from the following location:
app/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml
Now you can make any modifications you want to your overridden file.