By default, there’s no social sharing button in Magento product page. How to add these buttons to your product page of your theme so that customer can share the products they love with their friends on social networks? Today we will learn method to add these buttons to product page of Magento with 3 popular social networks: Facebook, Twitter and Google Plus.
First, take a look at the picture below, we’re going to make that trick:
First we need to know where Product page template files are located in Magento folder:
+ your_package_name (package)
+ your_theme_name (theme)
As you can see, view.phptml is the file we’re looking for
1. Adding Facebook like or Share button to product page
To add Facebook like/share button, go to https://developers.facebook.com/docs/plugins
Save file and refresh your page to see the change
2. Add Tweet button to product page
For twitter, we have Tweet button, to add it to product page just do the same as like button.
First go to this url to create Tweet/follow button and get code https://about.twitter.com/resources/buttons#tweet
After creating your button, copy the code and insert to view.phtml file
Now save file and refresh your page.
3. Add Google+ button to Magento product page
G+ button allows user to recommend their favorite content to Google Plus network
To generate the button you can go to https://developers.google.com/+/web/+1button/
<!-- Place this tag in your head or just before your close body tag. -->
<script src="https://apis.google.com/js/platform.js" async defer></script>
<!-- Place this tag where you want the +1 button to render. -->
<div class="g-plusone" data-annotation="inline" data-width="300"></div>
Next, insert the code to view.phpml file to make it appear on your Magento product page
Social network is one of the most strong channel to boost your store’s brand awareness and it can bring valuable traffic. If you don’t have these buttons on your Magento site, then do it today.
Hope you find the tutorial helpful, feel free to let me know if you have any questions.