Magento 2 – Add Custom PHTML File to Product Page

cataloglayoutmagento2

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

Best Answer

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>