We use cookies to understand how you interact with our site, to personalize and streamline your experience, and to tailor advertising. By continuing to use our site, you accept our use of cookies and accept our Privacy Policy.

Your Digital Commerce Experts
Nexcess Logo

Add Facebook Like Button to Magento Product View

August 14, 2011

Add Facebook Like Button to Magento Product View
It seems that every site you visit has a link to share this article, page or product with your Facebook friends. This tutorial will make it easy for your customers to share your products with their Facebook friends. For this article I will use the Magento default theme as reference, you may need to adjust your code slightly if you use a custom theme.

We will simply add the Facebook like button to your product view page. With your favorite text editor, I like Notepad++ , open /app/design/frontend/base/default/template/catalog/product/view.phtml and around line 50 find the following code:
[code language=”html”]

productAttribute($_product, $_product->getName(), ‘name’) ?>



[/code]

Place the following code on a new line below:
[code language=”html”]







[/code]

That block of code should look something like this:
[code language=”html”]



productAttribute($_product, $_product->getName(), ‘name’) ?>











[/code]

Refresh your product view page and you should see the like button. If you don’t see the change, you may need to refresh the Blocks HTML output cache in System > Cache Management.
Facebook Like Button

Yea, it’s as easy as that!

Nexcess
Nexcess

Power up your sites and stores with custom-built technology designed to make every aspect of the digital commerce experience better. Make your digital commerce experience better with Nexcess. Visit Nexcess.net today and see how we can help.