How I can move a element in product description page?
-
13-12-2020 - |
Question
I want to move a small div which html is like in console
<div class="feature-wrapper top-border">
<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_preferred_1"></a>
<a class="addthis_button_preferred_2"></a>
<a class="addthis_button_preferred_3"></a>
<a class="addthis_button_preferred_4"></a>
<a class="addthis_button_compact"></a>
<a class="addthis_counter addthis_bubble_style"></a>
</div>
<script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=xa-5054e6c6502d114f"></script>
</div>
I want to include this div in
product.info.main
like in my xml move is
<move element="page.main.title" destination="product-view-wrapper" />
so how I can include this div in product info
Solution
Create new PHTML file called share.phtml
in app/design/frontend/Package/theme/Magento_Catalog/templates/product/view/share.phtml
and add your DIV inside it.
add below code in catalog_product_view.xml
<referenceBlock name="product.info.main">
<block class="Magento\Catalog\Block\Product\View" name="share" template="product/view/share.phtml" />
</referenceBlock>.
then move your element inside product.info.main
<move element="share" destination="product.info.main" after="product.info.addto" />
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange