Here we will see how to add new custom tab on product view page in magento2.
First create file ‘catalog_product_view.xml’ in location ‘Vendor/Test/view/frontend/layout’:

<?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=”webe.tab” template=”Vendor_Test::webe_tab.phtml” group=”detailed_info” >
<arguments>
<argument translate=”true” name=”title” xsi:type=”string”>Webetutiorial Tab</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>

Now create file ‘webe_tab.phtml’ in location ‘Vendor/Test/view/frontend/templates’ and write content on the file.

If you want to use product details on this file, you can simply get product by $product = $block->getProduct();

<?php
// get current product
$product = $block->getProduct();
echo $product->getName();
?>

Categories: Blog

0 thoughts on “Add Custom Tab On Product View Page – Magento2”

Leave a Reply

Related Article

Blog

Om Beach: Gokarna, Karnataka, India

The modest sanctuary town of Gokarna gloats a modest bunch of shorelines worth going by, yet Om Beach named because of its normal similarity of the Om image makes our rundown on account of its Read more…

Blog

Chowpatty Beach: Mumbai, Maharashtra, India

Chowpatty Beach is an unquestionable requirement visit for sightseers going by Mumbai, particularly amid Ganesh Chaturthi, a Hindu celebration celebrated out of appreciation for the divinity Ganesha. The celebration, which ordinarily happens in August or Read more…

Blog

Could White Wine increase Your Melanoma Risk?

Another review raises the likelihood that individuals who appreciate a glass of white wine each day may confront a somewhat lifted danger of melanoma. Add up to liquor admission was connected with a 14 percent Read more…