2

I have created a custom tab on product view page , but i don't know how to call a phtml file into custom tab.

1
  • Did you get a solution ?
    – Pawan
    Commented Sep 2, 2018 at 5:31

1 Answer 1

2

You can use the following code for custom tab. I have created one module with name Vendor_Module and created it like below.

Paste the below content to catalog_product_view.xml file.

<?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> <referenceBlock name="product.info.details"> <block class="Magento\Catalog\Block\Product\View" name="test.tab" template="Vendor_Module::custom_tab.phtml" group="detailed_info" > <arguments> <argument translate="true" name="title" xsi:type="string">Your Tab</argument> </arguments> </block> </referenceBlock> </body> </page>
2
  • thank you for answer! but I want how to call another phtml file in that tab , means in your vendor_module phtml file i want call another phtml file Commented Sep 1, 2018 at 13:09
  • You can call your own phtml. Like if phtml is under Magento_Catalog/templates then you need to call Magento_Catalog::your_phtml.phtml Commented Sep 1, 2018 at 13:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.