0

I want to add some content within the product detail tab.
enter image description here

I created my template below

<referenceContainer name="product.info.details">
        <block class="Magento\Catalog\Block\Product\View" name="additional_product_details" template="Magento_Catalog::product/view/additional_product_details.phtml" />
    </referenceContainer>

I tried to use the <move /> syntax to achieve this but was unsuccessful.

Please note: I am not trying to create a custom tab.

1
  • How did you finally solve it? I'm facing the same problem and decorating the description value in Magento_Catalog/templates/product/view/attribute.phtml with additional content from another attribute just doesn't seem right to me.
    – Sebastian
    Mar 22 at 8:28

1 Answer 1

0

This way you can add a new tab.

In your view/frontend/layout folder, create a xml file named catalog_product_view.xml and add the following content. Do note the values to change. If you are adding this from a theme, then you will not have a view/frontend/layout folder. Instead you will have to create either Magento_Catalog/layout folder.

<?xml version="1.0"?>

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column"
      xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

      <body>

        <!--Product Main Content-->
        <referenceContainer name="content">
            <!--Detail tab section-->
            <block class="Magento\Catalog\Block\Product\View\Details" name="product.info.details" template="Magento_Catalog::product/view/details.phtml" after="product.info.media">

                <!--our custom tab -->
                <block class="Magento\Catalog\Block\Product\View\Attributes" name="product.uniqueNameForTab" as="customTab" template="Magento_Catalog::path/to/custom-features-template-file.phtml" group="detailed_info">
                    <arguments>
                        <argument translate="true" name="title" xsi:type="string">Custom Tab</argument>
                        <argument name="sort_order" xsi:type="string">20</argument>
                    </arguments>
                </block>

            </block>
        </referenceContainer>
    </body>
</page>

If you are still facing problems, I have a working code which I added multiple tabs. Let me know.

3
  • Hello John. As I mention in my post I am not trying to add a custom tab. I am trying to add content into the details tab directly. The code you provided is to create a custom tab which is not what I am looking for. For example what I am trying to do here is add a title in the detail tab "CHECK OUT THE PRODUCT INFORMATION" and some links. This will reside in the box as the picture shows If that is not possible, I was thinking I could maybe create a custom tab, add my content, but what I could not figure out was how to grab the product description information to also add to my custom tab.
    – ugo roubzy
    Aug 2, 2022 at 13:31
  • I can see that you have edited your question. Previously it mentioned about adding a tab. You can try adding a after plugin to "get product description attribute" and inject your content directly into the description field data. Aug 3, 2022 at 1:29
  • John I had to edit it, because I dont know how you read my question and interpreted I was asking to add a tab. You probably only read the last past and mistook what I said. I know how to add a custom tab, look at the image I provided it has 3 custom tabs already.
    – ugo roubzy
    Aug 3, 2022 at 13:29

Your Answer

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

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