Magento2 Product Admin – How to Add Product Tab for Specific Product Type in Magento 2

adminmagento2producttabs

How to add product tab using xml in admin? I want to show that tab particular product type.

How can i add this product tab using my custom module in magento 2?

Best Answer

you can add this in [Namespace]/[Module]/view/adminhtml/layout/catalog_product_new.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="product_tabs">
            <block class="[Namespace]\[module]\Block\Name\Here" name="block.name.here" />
            <action method="addTab">
                <argument name="name" xsi:type="string">block_name_here</argument>
                <argument name="block" xsi:type="string">block.name.here</argument>
            </action>
        </referenceBlock>
    </body>
</page>

then create the block [Namespace]\[module]\Block\Name\Here that implements Magento\Backend\Block\Widget\Tab\TabInterface.

Note:This Solution is working Only Magento 2.0x not in 2.1x

Related Topic