3

I want to add some static data in magento 2 product page in details.phtml

So please tell me how can i override this file without create any new module :

/opt/lampp/htdocs/magento2/vendor/magento/module-catalog/view/frontend/templates/product/view/details.phtml

0

2 Answers 2

0

You have to just override in your theme.

app/design/frontend/Vendor/themename/Magento_Catalog/templates/product/view/details.phtml
6
  • but i don't have any theme i have to just change in above details.phtml file
    – user46386
    Nov 3, 2016 at 6:03
  • you have to create theme or you have to directly add content inside your module template file Nov 3, 2016 at 6:04
  • Using directly override template file is not good practice in magento, You need to override template file using create theme in your magento Nov 3, 2016 at 6:04
  • please let me know if you have any issue Nov 3, 2016 at 6:10
  • I created /opt/lampp/htdocs/magento2/app/design/frontend/Vendor/theme/view/frontend/templates/product/view/details.phtml but don't get any changes in front product page
    – user46386
    Nov 3, 2016 at 6:13
0

add sequence in your module.xml as which module phtml you want ot override like :

    <sequence>
        <module name="Magento_Catalog"/>
    </sequence> 

then add file directly with same path as vendor module has and override code.

(if it has in layout you need to override it first then call this default.phtml file through layout xml)

Your Answer

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