1

I'am using Luma theme and I tried to override some phtml from module_catalog. In luma theme folder which is in vendor/theme-frontend-luma in /Magento_Catalog I created the same path as phtml form that I tried to override and it's not working.

Is it possible to do that in Luma theme? or the only way is to create my own theme in app folder to override file?

2
  • have you got answer? Nov 28, 2016 at 11:36
  • I am facing same issue, got any answer?
    – Gagan
    Jun 14, 2018 at 13:39

4 Answers 4

1

You can not change directly in vendon/magento/theme-frontend-luma folder instead of you have to create new theme in app/design/frontend/<vendor>/<theme>, you can refer magento docs How to create new theme in magento 2 ?

Once you create theme then you can override phtml file in your theme over here:

app/design/frontend/{vendor}/{theme}/Magento_Catalog/templates/{file.phtml}
0

I'm not sure you can overrride this way even if you can it's not ideal, you should create your own custom theme in app/design/frontend/<Vendor>/<theme> which inherits from Luma so any changes that you make will override Luma theme's functionality for rest it will use default luma styles/functionality.

Make sure to change theme in admin panel and it's deployed correctly through bin/magento setup:static-content:deploy command. Further read on Setting Up Custom Theme

0

You have to override using this path app/design/frontend/{vendor}/{theme}/Magento_Catalog/templates/{file.phtml}

You can also refer this blog. Overwrite module phtml file and re-write in own theme Magento 2

let me know if not work.

2
  • so in my case if i am using luma theme i need to create in designa folder another folder called luma? because i don't have a custom theme or something, i work with luma
    – user47014
    Nov 11, 2016 at 9:02
  • yes. you have to create folder in app/design/frontend/{vender}/{your_theme}/.. Nov 11, 2016 at 9:07
0

You can override template and block using layout handler

use to remove old block

<referenceBlock name="blockname" remove="true"/>

and then add your block

here is example

<body>
    <referenceBlock name="adjustments" remove="true"/>
    <referenceBlock name="creditmemo_totals">
        <block class="Magento\Sales\Block\Adminhtml\Order\Creditmemo\Create\Adjustments" name="Company_fee" template="Company_Custom::creditmemo/ktplfee.phtml"/>
    </referenceBlock>
</body>

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.