2

Can anyone help me how to include custom phtml file before reviews section in magento2

please find the screenshot below:

enter image description here

When i click on the button it is going to add to cart.

Thanks

1

add below code In catalog_product_view.xml in your theme

<?xml version="1.0"?>                                             
<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 class="Magento\Framework\View\Element\Template" name="customblock" template="Magento_Theme::html/custom.phtml" before="product.info.review"/>
    </referenceContainer>
</body>
</page>
  • Thanks @VDC it is coming after the addtocart section – shivashankar m Mar 1 at 9:57
  • OK so your review from is showing in Tab and you want to show this in Review Tab under review from right ? – VDC Mar 1 at 10:02
  • no problem with the place of the button but when i click on it, product is going to add to cart – shivashankar m Mar 1 at 10:03
  • 1
    in your custom button code don't use button type="submit" as place of use button type="button" – VDC Mar 1 at 10:06
  • 1
    <button type="button" class="btn btn-info share-btn">Share</button> – VDC Mar 1 at 10:16

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.