Call us now on 0115 9738074

Magento Q&A: Hide the price for a free product

Difficulty: Easy

Modification: Template File

Q:

I’m new to magento, and I would like to know if there is a way to hide the price of a product when it is 0?

I have a few free virtual product, and they have 0 as price. so the customer can order them for free. But I would like to hide the 0.

A:

That is fairly easy to do. You will need to modify the template file /app/design/forntend/default/your_skin/template/catalog/product/view.phtml.

In there you need to look for the piece of code responsible for displaying the price and surround it with additional code:

<?php if($_product->price==0): ?>

<?php echo 'FREE'; ?>
<?php
else: ?>
<!-- code that is currently displaying the price in your template -->
<?php endif; ?>
Share and Enjoy:
  • Facebook
  • Digg
  • del.icio.us
  • StumbleUpon
  • Google Bookmarks

Tags: , , , ,

2 Responses to “Magento Q&A: Hide the price for a free product”

  1. WMS says:

    can you clue us into what piece of code that might be to display the price? This sounds like a much easier fix than what is suggested on the Magento site.

  2. Jakub says:

    In the new version it was moved to the /catalog/product/view/type files. There is a separate file for each product type. Inside those file the line: getPriceHtml($_product) ?> is responsible for outputting the price. You need to surround it with the code given in the blog post above.

Leave a Reply