Remove price in product option

In Magento, simple or configurable products with custom options will show price change indicator in drop down. This feature may annoy some users and lots of our clients requested to remove it. In this article, I will show you a solution to do the change for simple and configurable product. It might not be a good solution as we have to change js in core system. Therefore, if you have any better idea, please suggest.

Here is the case we are working on:

This article will help you remove "+ $10", "+ $20", "+ $30" in the drop down. And I do this in Magento 1.6.2.0 if you want to know.

Configurable Product

To remove this for configurable product, you need to make changes in file js/varien/configurable.js. Open this file and find following code

var str = option.label;
if(price){
    if (this.taxConfig.showBothPrices) {
        str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')';
    } else {
        str+= ' ' + this.formatPrice(price, true);
    }
}
return str;

Change the code to following:

var str = option.label;
if(price){
    if (this.taxConfig.showBothPrices) {
        //str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')';
    } else {
        //str+= ' ' + this.formatPrice(price, true);
    }
}
return str;

Next, find formatPrice function, around line 235. Change the code from

var str = '';
price = parseFloat(price);
if(showSign){
     if(price<0){
          str+= '-';
          price = -price;
     }
     else{
           str+= '+';
     }
}

Into following

var str = '';
price = parseFloat(price);
if(showSign){
     if(price<0){
         // str+= '-';
          price = -price;
     }
     else{
           //str+= '+';
     }
}

Simple Product

This is quite different from configurable product. First, open app/code/core/Mage/Catalog/Block/Product/View/Options/Type/Select.php. As it is a core file, please copy it into local folder before making changes. In this file, replace this:

$select->addOption(
    $_value->getOptionTypeId(),
    $_value->getTitle() . ' ' . $priceStr . ''
);

with this

$select->addOption(
    $_value->getOptionTypeId(),
    $_value->getTitle()
);

Next, you need to replace this code

$selectHtml .= '
	
  • ' . ' ' . '';
  • With this

    $selectHtml .= '
    	
  • ' . ' ' . '';
  • That is all. Here is the result we will have:

    I hope this is helpful for you who want to remove these price change indicators. As always, if you need any help or have any suggestion, please leave me your comment or mail me at neo[at]magebuzz[dot]com.

    14 thoughts on “Remove price in product option”

    14 Responses to Remove price in product option

    • Adira Aden

      Well i dont think so that we can remove price in product options. In free shopping coupons and deals websites the product prices are help us a lot.

    • Neo

      I understand your points. This article might not be for your case but I am sure it will be helpful for lots of Magento users.

    • Bryton

      Neo, thanks for the article it saved my day.Thanks so much.Keep up the good work.

    • Dustin

      Thanks Neo. You may want to note that when using this method the pricing for these options will still display on the cart/checkout pages as well as in the product details inside the sidebar cart. The pricing will also show up in your transaction emails (such as order confirmation, invoices, etc.).

    • Dustin

      Options pricing can also be removed from bundle products by modifying code in the Checkbox, Multi, Radio and Select files in ...\template\bundle\catalog\product\view\type\bundle\option\Files_Here. Each file will have two instances of either:
      <?php echo $this->getSelectionTitlePrice($_selection, false) ?>
      <?php echo $this->getSelectionQtyTitlePrice($_selection, false) ?>
      Delete or comment out the first instance, and replace the second with:
      <?php echo $_selection->getName() ?>

      Note: This is will not remove the bundle options pricing from the Cart page or Cart Sidebar. To remove the option pricing in the cart and cart sidebar: http://www.magentocommerce.com/boards/viewthread/214919/

      Hope that helps, and good luck.

    • Simon

      Worked great, you saved my skin.

    • Neo

      Thank you Dustin for your great comment. I believe it will be very helpful for people. I will spend time to update my article with your comment. Thanks.

    • dk

      Hi Neo,
      Thanks for taking the time to write this article. Is it possible to do this so it only affects 1 website/template as apposed to the entire install? We have different websites (each with their own template) and we only want to remove the price on one of the sites.

    • Matrassen

      Very helpful! I was looking for this long time, it worked for me in Magento 1.7.0.2 (newest) version.

      Thanks!

    • MIRAOUI
      MIRAOUI on December 8, 2012 at 1:41 pm said:

      Hi
      Very helpful! I was looking for this long time, but how I can do it in the case of a virtual product.

      Thank you in advance

    • Dustin

      I did exactly this in 1.7.0.2 and I'm still seeing the + $0.00 values... Can anyone help me figure out why?

    • Akash

      It doesn't work in Magento 1.9.0.1 version.

      Please update your code.

    • Suvankar Giri

      var str = option.label;
      if(price){
      if (this.taxConfig.showBothPrices) {
      //str+= ' ' + this.formatPrice(excl, true) + ' (' + this.formatPrice(price, true) + ' ' + this.taxConfig.inclTaxTitle + ')'; /*** Comment This ***/
      } else {
      //str+= ' ' + this.formatPrice(price, true); /*** Comment This ***/
      }
      }
      return str;
      },

      formatPrice: function(price, showSign){
      var str = '';
      price = parseFloat(price);
      if(showSign){
      if(price<0){
      //str+= '-'; /*** Comment This ***/
      price = -price;
      }
      else{
      //str+= '+'; /*** Comment This ***/
      }
      }

      var roundedPrice = (Math.round(price*100)/100).toString();

      if (this.prices && this.prices[roundedPrice]) {
      //str+= this.prices[roundedPrice]; /*** Comment This ***/
      }
      else {
      //str+= this.priceTemplate.evaluate({price:price.toFixed(2)}); /*** Comment This ***/
      }
      return str;
      },

    • ritayan
      ritayan on July 9, 2015 at 1:49 pm said:

      i just do it with jQuery
      just add this code
      /magento/app/design/frontend/base/default/template/catalog/product/view/options/type/select.phtml (magento 1.9)

      jQuery(document).ready(function(){
      jQuery("#select_getId() ?>").each(function () {
      jQuery('option', this).each(function () {

      var text=jQuery(this).text();
      var newtext= text.split('+');

      jQuery(this).text( newtext[0]);
      });
      });
      });

      what do you think :)

    Comments