There. After success migration work, i need to handle devlopment work,ugh. I'm a mad newbie about Magento2 so could you let me know how to overwrite the default phtml file under vendor/magento .. folder.


Currently, our website has no theme (it means default Luma theme, right?) And i was trying to overwrite some phtml files using order confirmation email. (it seems that it is not much related with which theme i'm using tho).

  1. Copied templates need to make override in:


  1. Location contain templates using to override:


  1. Run commands after modification

    php bin/magento setup:static-content:deploy
    find pub/ -type f ! -perm 0644 -exec chmod 0644 {} \;
    find pub/ -type d ! -perm 0755 -exec chmod 0755 {} \;

What should i do? Thank you

1 Answer 1


Location seems wrong

It should be


Instead of


As your your theme is luma And this theme is register under vendor/magento/theme-frontend-luma

So,Other should modify code at this located

Create a template file items.phtml at vendor/magento/theme-frontend-luma\Magento_Sales\templates\email.

And that new items.phtml you can work.

Via custom module

If you donot want to work at direct vendor folder then you need create a custom module

This module should consist of below files:

  • app/code/app/code/{vendorname}/{Company}/registration.php
  • app/code/{vendorname}/{Company}/composer.json
  • app/code/{vendorname}/{Company}/etc/module.xml

then Create a layout file sales_email_order_items.xml at app/code/{vendorname}/{Company}/view/frontend/layout

On this sales_email_order_items.xml add below code for change the template via layout.

<?xml version="1.0"?>
 <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd" 
    label="Email Order Items List" design_abstraction="custom">
     <referenceBlock name="items">
         <argument name="template" xsi:type="string">{vendorname}_{Company}::sales/email/items.phtml</argument>

Now new template phtml is located at app/code/{vendorname}/{Company}/view/frontend/templates/sales/email/items.phtml.

Now you do after you want.

After this your should do below

delete all file from var/cache and var/view_preprocessed and page_cache using rm -rfvar/cacheandrm -rf var/view_preprocessed,rm -rf var/page_cache`

  • Thank you for answering me , Amit. By the way, do i have to put layout file?
    – 3CE
    Commented Oct 5, 2017 at 14:43
  • It doesn't work in magento 2.1.9
    – 3CE
    Commented Oct 5, 2017 at 15:33
  • is this work?..
    – Amit Bera
    Commented Oct 6, 2017 at 15:40
  • Yes! It works !
    – 3CE
    Commented Oct 18, 2017 at 19:17
  • Happy to hear that
    – Amit Bera
    Commented Oct 18, 2017 at 19:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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