In this post, we will look at how to add a custom tab in product detail page in magento 2.

Creating file:

Create file catalog_product_view.xml in

app/design/frontend/{vender name}/{theme name}/Magento_Catalog/layout

In the file write following code:

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceBlock name="">
   <block class="Magento\Catalog\Block\Product\View" name="" as="customtab" template="product/view/custom_tab.phtml" group="detailed_info" >
         <argument translate="true" name="title" xsi:type="string">Custom Tab Title</argument>

Now you need to create file custom_tab.phtml in the path:

app/design/frontend/{vender name}/{theme name}/Magento_Catalog/templates/product/view

In the file you can write any content that you want to show in newly created tab.