Hello Everyone,
In this blog, we will learn about how to Create Custom Tab on the Product View Page in Magento 2.
Without wasting your time, let us guide you straight away. Follow the easy step given below to Create Custom Tab on Product View Page in Magento 2.
STEPS FOR CREATE CUSTOM TAB ON PRODUCT VIEW PAGE IN MAGENTO 2
Step 1: Create file catalog_product_view.xml
app/code/Vendor/Extension/view/frontend/layout/catalog_product_view.xml
<?xml version="1.0"?>
<page layout="2columns-left" 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="demo.tab" template="Vendor_Extension::demotab.phtml" group="detailed_info" >
<arguments>
<argument translate="true" name="title" xsi:type="string">Magecurious Custom Tab</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
Step 2: Create demotab.phtml
app/code/Vendor/Extension/view/frontend/templates/demotab.phtml
<h2>This is a Custom Tab</h2>
Step 3: Finally run the below commands
$ php bin/magento cache:clean
$ php bin/magento cache:flush
Step 4: Output:
Final Thoughts:
So this was the easiest way which we have told you in this blog. This is how you can Create Custom Tab on the Product View Page in Magento 2. Hope you liked the blog.
So quickly go to the comment box and tell me how you like this blog?
Stay tuned with us on our site to get new updates of Magento.
Thanks for reading and visiting our site.
