Magento 2: Add new tab in Product detail page


New tab in product detail page is very easy task with product attribute. Use below steps and check it out.

Step 1. Create Product Attribute “video”.

Step 2. Create file “catalog_product_view.xml” in the app/design/frontend/{vender name}/{theme name}/Magento_Catalog/layout

In the file write the below code:


<!-- this is code to add new tab start -->
<referenceBlock name="product.info.details">
<block class="Magento\Catalog\Block\Product\View\Description" name="product.info.video" template="product/view/attribute.phtml" group="detailed_info">
<arguments>
<argument name="at_call" xsi:type="string">getVideo</argument>
<argument name="at_code" xsi:type="string">video</argument>
<argument name="css_class" xsi:type="string">video</argument>
<argument name="at_label" xsi:type="string">none</argument>
<argument name="title" translate="true" xsi:type="string">Video</argument>
</arguments>
</block>
</referenceBlock>
<!-- this is code to add new tab end -->

Now check in the Detail page.

Advertisements

One thought on “Magento 2: Add new tab in Product detail page

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s