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. Commented Jul 15, 2017 at 7:30
  • 1
    Both answers are technically correct, but @PrincePatel had the answer that worked best for me.
    – Jcargs
    Commented Jul 17, 2017 at 13:09

3 Answers 3


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"/>

i have installed an extension which i have purchased + a theme also which is bought from somewhere and now i want to override it too but the problem is i am unbale to figure out where i need to place it in app/design directory. should i place this extension directory from the vendor folder to my theme dir i.e app/design/frontend/theme_vendor/theme/ or should i place it in app/design/frontend/vendor_extension/extension

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.