Hiding Product Prices in Magento

One of the more common requests that online merchants have is for hiding the price of a product, or certain products, in Magento. While this might seem like a straightforward topic, it reality it can involve quite a few modifications depending on the exact request and the exact needs of the client. First and foremost, the […]

By Joel Holtzman

One of the more common requests that online merchants have is for hiding the price of a product, or certain products, in Magento. While this might seem like a straightforward topic, it reality it can involve quite a few modifications depending on the exact request and the exact needs of the client. First and foremost, the store owner has to decide where they want the product price hidden from. The product page? The category page? Both? Only for certain products?

Before we delve into the how, let’s talk about the why. One reason for hiding price comes from retailers who are selling a product below the MSRP (Manufacturer’s Suggested Retail Price). Certain Manufacturer’s might have policy’s that prohibit the display of prices which are below the MSRP. Openly displaying a price below the MSRP could be a very serious legal issue for the store owner. Another reason is that hiding a products price is a way to get customers to add products to their cart to then see the price. WIth the product in their cart, there might be a higher chance that they decide to checkout at your store as opposed to shopping around at several different stores. Another possible reason for hiding a products price is that the product is made of a material that fluctuates in price. For example, if the product was made of gold or silver, those prices can change dramatically in a matter of minutes. In those situations, it is often best to have the customer call the store for the products real price, or have it updating very nearly instantaneously in relationship to the materials cost.

How do I hide prices? Well, there are a few different methods. The first is to use a pre-existing extension. One such extension is Amasty’s “Hide Price” which allows you to:

  • Hide product price
  • Disable adding to cart, comparison and wish list
  • Organize private sales
  • Choose customer groups who can view prices
  • Encourage people to contact you for pricing

Another is cart2quote’s Not2Order which allows you to:

  • Hide prices
  • Disable ordering (for products, product ranges, storeview, store, or website)
  • Optionally show prices for registered customers
  • Gives full control over which products have prices and which have add to cart buttons

However, a third way for hiding product prices is to modify the view files for your Magento Store. How you go about doing this will depend largely on your needs and the types of products you have. Covering all of the different ways to hide products for all of the different product types is beyond the scope of this article, instead we will cover only Simple Products.

The first step, regardless of which way or where you want to hide product price is to turn on Template Path Hints under System -> Configuration -> Developer tab (make sure you have the correct store view in the upper left of the System -> Configuration page).

When you turn on your hints and load the product view page, you should see something like this: frontend/base/default/template/catalog/product/price.phtml as the template file controlling the price. You’ll want to copy this file to frontend/yourpackage/yourtheme/catalog/product/price.phtml

The best practices for Magento state that you never want to directly modify a core file, instead you want to take advantage of Magento’s theme hierarchy and fallback system which allows you to create customized phtml files. Open the new copied file in your favorite text editor.

If you need help with your Magento store, call 845-656-3000 or Contact us here »

1. Hiding the price of every product until added to cart:

Assuming you want to just hide the price of every item on your site, and instead have it so that the prices will show only when added to cart, you can comment out line 209 and add in a line below it that tells the customer to add it to their cart to the price first.

Before:

Line 209: <?php echo $_coreHelper->formatPrice($_price, true) ?>

After:

Line 209:         <?php //echo $_coreHelper->formatPrice($_price, true) ?>

New Line 210: <?php echo ‘Add to Cart to See Price’; ?>

 


It should look something like this:

Screen Shot 2015-03-24 at 5.04.55 PM Here’s how the product page looks after:

Screen Shot 2015-03-24 at 5.09.50 PMAnd here’s how it will look on the category page:

Screen Shot 2015-03-24 at 5.09.48 PM As your can see, this is a very simple yet effective means to hiding every products price and replacing it with your own custom text – not only on the product page, but also on the category page. However, be forewarned that with for example products with tiered pricing, there is additional modifications you have to make.

2. Hiding Price Based Off Of Category:

First you’ll need to go to Catalog -> Manage Categories and get the category ID(s) from the categories you want to hide the price on. One must be careful to note that since a product can have multiple categories, if they hide the products price from one category, it won’t show for any of the categories that the product is in. Keep in mind, it’s further possible to customize the following code to detect which category the product is in

Replace line 209 with the following (be sure to change the $hideCategories to meet your needs and separate each with a comma)

$hideCategories = array(‘3′,’10’);

$productCategoryIds = $_product->getCategoryIds();

$productDisplayPrice = $_coreHelper->formatPrice($_price, true);

 

foreach ($productCategoryIds AS $productCategoryId) {

if (in_array($productCategoryId, $productCategoryIds)) {

$productDisplayPrice = ‘Price Hidden’;

break;

}

}

echo $productDisplayPrice;

Screen Shot 2015-03-25 at 9.21.26 AM

3. Hiding the product price based off of specific products:

For hiding specific product prices, I definitely recommend that you create a “hide_price” (“Yes/No”) attribute in the backend and assign it to products that you wish to hide as “yes”. While it is possible to simply get all of the product IDs you wish to hide and base the code of that – maintaining it will become a challenge if they end up changing frequently or you need to add more further down the road. This holds especially true when the product types changes or more than one file must be modified.

if ($_product->getHidePrice()) {

echo ‘Price Hidden’;

}

else {

echo $_coreHelper->formatPrice($_price, true);

}

If you need help with your Magento store, call 845-656-3000 or Contact us here »

4. Magento’s built in MSRP 

One last thing to consider is that Magento comes comes with a built in option to hide the products price. However, by avoiding use of it, one can customize their own sets of rules and conditions and have them automatically apply to every new product. This not only avoids an extra step in product set up, but allows for very unique and specific customizations. 

Here’s how to set that up under System -> Configuration -> Sales -> on the Minimum Advertised Price tab.

Screen Shot 2015-03-25 at 9.23.21 AM

Here’s an example of how a product would be configured using M.A.P.

Screen Shot 2015-03-25 at 9.23.11 AM

And here’s how it looks on the frontend:

Screen Shot 2015-03-25 at 9.28.14 AM

Hope this post has been helpful and can serve as a guide if you’d like to hide product prices on your Magento store. Feel free to comment below if you have something to add or you got a question.

Magento Development Lead