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>
    <script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=xa-5054e6c6502d114f"></script>

I want to include this div in


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


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" />

then move your element inside product.info.main

<move element="share" destination="product.info.main" after="product.info.addto" />
  • and how you accessed that html ? I didnt get where and how you include that div in phtml ? – ephemeral Oct 11 '17 at 15:29
  • Its a sharing script which you get online from sharethis site. So add that code inside phtml file and you are good to go – Abhishek Panchal Oct 11 '17 at 15:31
  • you have to add that div in share.phtml file and reference block inside XML file. check my update answer – Abhishek Panchal Oct 11 '17 at 15:36
  • basically my question is how to add DIV inside xml. and you said 'and add your DIV inside it' I dont know this step . can you tell about it please ? – ephemeral Oct 11 '17 at 15:38
  • Are you saying that I should include that html in phtml file as it is copy paste ? – ephemeral Oct 11 '17 at 15:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.