How to Add a Line Break to Product Descriptions in Magento

This is one of those things you would think would already be in place with Magento Commerce but it isn’t. We want to have line breaks in our product descriptions in our Magento stores. Our clients want these as well so you don’t have to teach someone to add the <br> tags at each line break.

So here is how to add line breaks to product descriptions in Magento:

  1. Open /app/design/frontend/default/yourtheme/template/catalog/product/view/attributes.phtml
  2. Find this bit of code: productAttribute($_product, $_data['value'], $_data['code']) ?>
  3. Change that code to this: productAttribute($_product, nl2br ($_data['value']), $_data['code']) ?>
  4. Save your file.

You must be logged in to post a comment.