2

I am trying to add custom tabs in a new section on product detail page and not the existing "detailed_info" group where generally tabs are being added.

You can see the screenshot as given below :

enter image description here

Let me know, if its possible and how ?

Any help will be appreciated. Thanks !

0

To extend default tabs on PDP use this structure

<referenceBlock name="product.info.details">
    <block class="Magento\Catalog\Block\Product\View\Attributes" name="my.tab" as="additional" template="product/view/attributes.phtml" group="detailed_info">
                    <arguments>
                        <argument translate="true" name="title" xsi:type="string">My Information</argument>
                    </arguments>
     </block>
</referenceBlock>

To create new tab group i think you need:

  1. Copy module-catalog/view/frontend/templates/product/view/details.phtml template
  2. Set different name for file and modify line

    $block->getGroupChildNames('detailed_info', 'getChildHtml') to $block->getGroupChildNames('my_tab_group', 'getChildHtml')

3 add this layout to catalog_product_view.xml

    <block class="Magento\Catalog\Block\Product\View\Description" name="my.new.tabs" template="product/view/new_details.phtml" after="product.info.media">
        <block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes" as="additional" template="product/view/attributes.phtml" group="my_tab_group">
            <arguments>
                <argument translate="true" name="title" xsi:type="string">More Information</argument>
            </arguments>
        </block>
    </block>

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.