Magento 2 Add Custom tab in Product Page
-
05-03-2021 - |
Pergunta
I like to view my product page information details like "accordion-toggle" and let me need to add custom tab with static text in same page information details.
Solução
create below file in this location
app/design/frontend/[VendorName]/[theme]/Magento_Catalog/layout/catalog_product_view.xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.details">
<block class="Magento\Catalog\Block\Product\View" name="custom.tab" template="product/view/custom_tab.phtml" group="detailed_info" >
<arguments>
<argument translate="true" name="title" xsi:type="string">Cutom Tab</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
Go to this link
app/design/frontend/[VendorName]/[theme]/Magento_Catalog/templates/product/view/custom_tab.phtml
<?php echo __("test")?>
Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange