Magento content management system allows its customers to share their products with friends. Using the Facebook like button, you can recommend the product to your friends. This tutorial will cover how you can add Facebook like button in Magento stores in easy steps. But, if you wish to add Facebook like button in Magento shopping cart, then you have first to create a static block to accommodate the widget. You need to follow two steps to add Facebook like button in Magento:
- Create a static block to add Facebook like button in Magento
- Create a widget to add Facebook like button in Magento
Create a Static Block to Add Facebook Like Button
Follow the steps to create a static block where you can add Facebook like button:
- Log in to the Admin Panel after entering correct credentials
- Select CMS > Static Blocks
- Click ‘Add New Block’ from Static Blocks management page
- Define all the required fields: Block Title, Identifier, Store View, and Status
- Click ‘Show/Hide Editor’ to disable the WYSIWYG editor
- Paste the code provided by Facebook’s Developer documentation in the Content section
- Paste the following code:
<script type="text/javascript">
var likeIt = '<iframe src="https://www.facebook.com/plugins/like.php?href='+document.URL+'" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px;"></iframe>';
document.write(likeIt);
</script>
- Click ‘Save Block’ to save the changes made
Create a Widget to Add Facebook Like Button
Follow the steps to create and customise the widget to add Facebook like button in Magento:
- In the Admin Panel, Select CMS > Frontend Apps
- From Manage Frontend Apps page, click ‘Add New Frontend App’
- Select CMS Static Block in settings and click ‘Continue.’
- Enter the name of this frontend app in ‘Frontend App Title.’
- Set the sort order in its respective field
- Click ‘Add Layout Update’
- Set ‘Display On’ to all pages
- Choose ‘Block Reference’ to fit your layout needs
- Click ‘Frontend App Options’
- Click Select Block’ to choose the CMS static block
- Click ‘Save’ to save the changes made
If you are unable to add Facebook like button in your Magento store, then Request a Quote. Our Magento support team will assist you in adding the Facebook like button in your online Magento run store.