6

How can I use arguments in an xml layout file to overwrite the Details tab title on the product details page? The layout file I hope to overwrite is: vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml The block in the file is: enter image description here

3 Answers 3

10

In app/design/frontend/[Package]/[Yourtheme]/Magento_Catalog/layout/catalog_product_view.xml:

<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="product.info.details">                
            <referenceBlock name="product.info.description">
                <arguments>
                    <argument name="title" translate="true" xsi:type="string">Description</argument>
                </arguments>
            </referenceBlock>
        </referenceBlock>
    </body>
</page>

If you want to add a new tab, i.e attribute how_to_use:

<block class="Magento\Catalog\Block\Product\View\Attributes" name="product.info.how_to_use" template="product/view/attribute.phtml" group="detailed_info">
            <arguments>
                <argument name="at_call" xsi:type="string">getHowToUse</argument>
                <argument name="at_code" xsi:type="string">how_to_use</argument>
                <argument name="css_class" xsi:type="string">details-how-to-use</argument>
                <argument name="at_label" xsi:type="string">none</argument>
                <argument name="title" translate="true" xsi:type="string">How to use</argument>
            </arguments>
        </block>
4

In your custom layout file you can call the following:

<referenceBlock name="product.info.description">
    <arguments>
        <argument name="title" translate="true" xsi:type="string">Custom Name</argument>
    </arguments>
</referenceBlock>
2
    <referenceBlock name="product.info.description">
        <action method="setTitle">
            <argument name="title" xsi:type="string">NewTitleGoesHere</argument>
        </action>
    </referenceBlock>
0

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.