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; ?>
Tags: Design, Development, Ecommerce, Magento, Q&A






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.
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.