0

I have Description and Short Description, I see the values of these attributes, but I do not see their titles. Why?

I tried to set the titles by doing:

app/design/frontend/MyTheme/Magento_Catalog/layout/catalog_product_view.xml

    <referenceBlock name="product.info.details">
        <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description"
               as="description" template="Magento_Catalog::product/view/attribute.phtml" group="detailed_info">
            <arguments>
                <argument name="at_call" xsi:type="string">getDescription</argument>
                <argument name="at_code" xsi:type="string">description</argument>
                <argument name="css_class" xsi:type="string">description</argument>
                <argument name="title" translate="true" xsi:type="string">More Information</argument>
                <argument name="sort_order" xsi:type="string">5</argument>
            </arguments>
        </block>
    </referenceBlock>

But I didn’t succeed.

How to set titles for Description and Short Description so that they can be seen on the product page?

After the postponement when I saw that in

/vendor/magento/module-catalog/view/frontend/templates/product/view/details.phtml

is not coming Description and Short Description, but why - I do not know. Does anyone have any options?

2
  • you add any custom code ?? Commented Apr 17, 2020 at 16:30
  • For Magento_Catalog? No Commented Apr 17, 2020 at 16:34

2 Answers 2

2

to display title with this code you need to add one argument in this block xml with below parameter.

<argument name="at_label" xsi:type="string">Custom Heading or Title</argument>

in your code you need to add below changes.

<referenceBlock name="product.info.details">
    <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description"
           as="description" template="Magento_Catalog::product/view/attribute.phtml" group="detailed_info">
        <arguments>
            <argument name="at_call" xsi:type="string">getDescription</argument>
            <argument name="at_code" xsi:type="string">description</argument>
            <argument name="css_class" xsi:type="string">description</argument>
            <!-- add this line to display heading. -->
            <argument name="at_label" xsi:type="string">More Information</argument>
            <argument name="title" translate="true" xsi:type="string">More Information</argument>
            <argument name="sort_order" xsi:type="string">5</argument>
        </arguments>
    </block>
</referenceBlock>

To Edit title for existing tab you can use below code for change description title.

Add this code in catalog_product_view.xml file.

<referenceBlock name="product.info.description">
    <arguments>
        <argument name="title" translate="true" xsi:type="string">Custom Description</argument>
    </arguments>
</referenceBlock>

Hope this solution help you to complete you task.

Note: Please make it right and add plus to this solution if this solution work for you.

Thank you.

4
  • this works to display labels, but the title I can’t display Commented Apr 18, 2020 at 15:22
  • What do you need by title yo need to change the tab title. Commented Apr 19, 2020 at 6:44
  • If you add argument title it will reflect to tab title. it will display as a tab. Commented Apr 19, 2020 at 6:46
  • Titles for description and short description are not displayed. I can display the label, but the title is not displayed. Your answer works for the label, thanks, but the title still doesn’t appear and I can’t change it either Commented Apr 19, 2020 at 11:51
0

Try checking your short description in another scope. Often you see the correct value in the backend because you see it for the global scope. But if there is an empty value for the store view scope, the attribute will be invisible in the frontend.

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.