0

I have 4 custom tabs on the product detail page.

How to add the tag to the tab heading.

catalog_product_view.xml

<block class="Magento\Catalog\Block\Product\View" name="magneticBallastTable.tab" template="VENDOR_Dvpage::tabs/content.phtml" group="detailed_info" >
                <arguments>
                    <argument translate="true" name="title" xsi:type="string">Product Versions Comparison</argument>
                    <argument name="sort_order" xsi:type="string">70</argument>
                </arguments>
            </block>

1 Answer 1

1

First you have to create a catalog_product_view.xml under 'MyVendor/MyModule/view/frontend/layout/' and add below code.

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="product.info.main">            
            <block class="Magento\Framework\View\Element\Template" name="custom_product_detail" as="custom_product_detail" template="Solwin_AfterTest::tab.phtml" after="-"/>
        </referenceContainer>
    </body>
</page>

Now, Create tab.phtml under 'MyVendor/MyModule/view/frontend/templates/' and add below script.

<script type="text/javascript">
    require(['jquery'], function () {
        jQuery(document).ready(function () {
            jQuery(".switch").each(function() {
                jQuery( this ).html('<h1>'+jQuery( this ).html()+'</h2>')
            });
        });
    });
</script>

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.