I am trying to add a new tab in the product page in admin but it's no appears in the product page.

The code is:


<?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">
    <referenceBlock name="product_form">
        <block class="Vendor\Demo\Block\Adminhtml\Catalog\Product\Edit\Tab\Demo" name="demo.tab">
                <argument name="config" xsi:type="array">
                    <item name="label" xsi:type="string" translate="true">Demo Tab</item>
                    <item name="collapsible" xsi:type="boolean">true</item>
                    <item name="opened" xsi:type="boolean">true</item>
                    <item name="sortOrder" xsi:type="string">2</item>
                    <item name="canShow" xsi:type="boolean">true</item>
                    <item name="componentType" xsi:type="string">fieldset</item>


  namespace Vendor\Demo\Block\Adminhtml\Catalog\Product\Edit\Tab;

  use Magento\Backend\Block\Template\Context;
  use Magento\Framework\Registry;

  class Demo extends \Magento\Framework\View\Element\Template{

     protected $_template = 'product/edit/demo.phtml';

    protected $_coreRegistry = null;

    public function __construct(
                              Context $context,
                              Registry $registry,
                              array $data = []
       //echo "heloooo"; exit;
        $this->_coreRegistry = $registry;
        parent::__construct($context, $data);

   public function getProduct(){
      return $this->_coreRegistry->registry('current_product');




the tab not appearing in admin page.

  • From the initial review, it seems that you have typo mistake in namespace defined in the block file. It should be like Vendor\Demo\Block\Adminhtml\Catalog\Product\Edit\Tab, since you have used Vendor everywhere else in your question. – Mohit Kumar Arora Nov 6 '18 at 6:29
  • @MohitKumarArora, It's my typing issue in editor and i update in above. the above code is not working – Ramesh Nov 14 '18 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.