2

I want to add two new custom tabs on product view page first one is added but when i add second tab i got error. "product.category" is not a child of "product.info.details". Resolve the issue and try again.

catalog_product_views.xml

 <referenceBlock name="product.info.details">
      <block class="vendor\Module\Block\BlockName"
        name="products.tab"
        template="Vendor_Module::first.phtml"
        group="detailed_info">
          <arguments>
              <argument translate="true" name="title" xsi:type="string">Custom tab 1</argument>
                      <argument name="sort_order" xsi:type="string">200</argument>
          </arguments>
      </block>
       <block class="vendor\Module\Block\BlockName"
        name="product.category"
        as="additional"
        after="products.tab"
        template="Vendor_Module::second.phtml"
        group="detailed_info">
                <arguments>
                    <argument translate="true" name="title" xsi:type="string">Custom tab2</argument>
                    <argument name="sort_order" xsi:type="string">220</argument>
                </arguments>
            </block>
  </referenceBlock>

1 Answer 1

2

You need to remove after="products.tab".

<referenceBlock name="product.info.details">
      <block class="vendor\Module\Block\BlockName"
        name="products.tab"
        template="Vendor_Module::first.phtml"
        group="detailed_info">
          <arguments>
              <argument translate="true" name="title" xsi:type="string">Custom tab 1</argument>
                      <argument name="sort_order" xsi:type="string">200</argument>
          </arguments>
      </block>
       <block class="vendor\Module\Block\BlockName"
        name="product.category"
        as="additional"
        template="Vendor_Module::second.phtml"
        group="detailed_info">
                <arguments>
                    <argument translate="true" name="title" xsi:type="string">Custom tab2</argument>
                    <argument name="sort_order" xsi:type="string">220</argument>
                </arguments>
            </block>
  </referenceBlock>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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