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

Latest Article

Blog

Samsung Galaxy S8 might get a Portrait Mode with the next update

One of the hottest cell phone camera includes this year has seemingly been the Portrait mode, which enables a client to obscure the foundation of a subject along these lines giving more profundity to the Read more…

Blog

Huawei Mate 10 Lite with 18:9 display and four cameras declare

Huawei declare its leaders Mate 10 and Mate 10 Pro. In any case, in an unexpected move, Huawei has now quietly declared the spending gadget. The Huawei Mate 10 Lite too accompanies a stretched 5.9-inch Read more…

Blog

Xiaomi becomes India’s fastest growing smartphone brand

Riding on the accomplishment of its Redmi Note 4 gadget, Xiaomi has turned into the quickest developing cell phone mark in the second from last quarter of 2017, with a development of 292 for every Read more…