I have installed a magento 2 extension via composer. Using composer to install an extension places the file inside of the core vendor file.

File I want to edit:


I have tried to place the above path inside of app/code wit hthe following path, but this did not seem to work.


If I want to extend the extension that I just installed. How would I do this?

  • Let me know if you have any issue. – Prince Patel Jul 15 '17 at 7:30
  • 1
    Both answers are technically correct, but @PrincePatel had the answer that worked best for me. – Jcargs Jul 17 '17 at 13:09

You just need to copy template.phtml in your custom theme at


flush cache and try..!


Check the layout file of original extension which will contain block name and template attached to it something like

<block class="Vendorname\Module\Block\Test"

To overwrite this test.phtml file, in your module's layout file add this

<?xml version="1.0"?>

<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/layout_generic.xsd">
    <referenceBlock name="vendorname.test">
        <action method="setTemplate">
            <argument name="template" xsi:type="string">Mycustom_Test::overwritten.phtml</argument>

In your layout file reference the same block name which is used in original extension as per above example.

Add following code in your module's etc/module.xml file to load your layout after original layout file

        <module name="Vendorname_Module"/>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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