I am using magento 2.3.3
in custom theme and I want to compare products add in new tab
how can achieve this?
Thanks in advance
1 Answer
On Product Detail Page, First Create a new tab and add below code in xml.
In your theme/module's catalog_product_view.xml
if you want to create a new phtml in new tab use below code
<referenceBlock name="product.info.details">
<block class="Vendor\ModuleName\Block\Product\View\Attributes" name="product.question" template="product/view/yournewphtmlfile.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Product Question</argument>
</arguments>
</block>
</referenceBlock>
Or to move content add below code to add compare products to details tab.
<move element="category.product.addto.compare" destination="product.question" />
-
can you provide me here full code? because if i will create tab and what name given of tab and how to add code Mar 20, 2020 at 5:21
-
thank you for your answer but here you have defined block class name in module name and template but i am not using custom module i want to compare product transfer in new tab Mar 20, 2020 at 5:41
-
refer this link :- magento.stackexchange.com/questions/106299/… 2.) magento.stackexchange.com/questions/146229/… Mar 20, 2020 at 5:42
-