How to add custom .phtml file in product details page. I also try this code in catalog_product_view.xml file, but can't working. enter image description here

2 Answers 2


Please use below code:

<?xml version="1.0"?>
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceContainer name="content">
            <block after="product.info.details" class="Vendor/Module/Block/Module" name="extra" template="Vendor_Module::extra.phtml" />        
  • Can I add this custom.phtml file in product page on installation of a plugin? Jan 8, 2018 at 6:43

You can try below code, Your phtml file content will display near social icon, You can change referenceBlock name if you want to change position

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
        <referenceBlock name="product.info.social">
            <block class="Example\Examples\Block\Question" name="example.tab" template="Example_Examples::success.phtml">

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.