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.
2 Answers
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">
<body>
<referenceContainer name="content">
<block after="product.info.details" class="Vendor/Module/Block/Module" name="extra" template="Vendor_Module::extra.phtml" />
</referenceContainer>
</body>
</page>
-
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">
<body>
<referenceBlock name="product.info.social">
<block class="Example\Examples\Block\Question" name="example.tab" template="Example_Examples::success.phtml">
</block>
</referenceBlock>
</body>
</page>