Custom Options Set Price to 0 in Magento 1.7 – The Fix

I’m working on a side project with Magento… There is a bug in 1.7 where when you use custom options, and your theme doesn’t include it’s own options.phtml file, the price will set to $0 (zero) when a user selects the price.

A bunch of forum posts have people talking about the problem. Basically it’s a silly bug in the javascript in options.phtml.

Basically, if your theme doesn’t have that options file in it’s theme directory, then magento looks like it defaults to the base‘s folder and includes the “default” options.phtml.

Here is the fix. I hope Magento includes it in the next Magento release!

Line 123 of options.phtml in

Right now is

price += parseFloat(config[optionId][element.getValue()]);

Should be

price += parseFloat(config[optionId][element.getValue()].price);

Basically the code was trying to convert a javascript Object to a float… making the price 0.

Please share this page to others who experience the same issue.

29 thoughts on “Custom Options Set Price to 0 in Magento 1.7 – The Fix”

  1. Thanks for the info but I looked at the options.phtml file and that code isnt in there? Anything else I can do?


  2. Yes I’m having the same issue as Kurt posted on 6/17. I don’t have this line in my options.phtml file in the base directory. On line 123 I have

    if (element.type == ‘checkbox’ || element.type == ‘radio’) {

    We’re running Magento version

    Any help would be appreciated. Thanks!

  3. Brian,
    Do you have the line
    price += parseFloat(config[optionId][element.getValue()]);


  4. Your code is incorrect it should be

    price += parseFloat(config[optionId][element.getValue()].price);

    Because the .price should be outside the square brackets.

    1. Hi, Sorry but this code doesn’t work for me, Might be I m doing something wrong.I hv ctaered one directory call bestseller under the template directory in my path for the bestseller.phtml is C:\wamp\www\magento\app\design\frontend\default\mycustom\template\bestseller\bestseller.phtml , is that right ???and I hv put that block part in my homepage content section.. and i hv changed to {{block type= core/template show_total=”12? template= bestseller/bestseller.phtml }}So what is the wrong here?I couldn’t see anything on my homepage..Plz help.

  5. Thanks so much for this!!!

    At first I couldn’t find the code you were referencing. I eventually found it in my theme directory app/design/frontend/mycustomtheme/template/catalog/product/view/options.phtml

    When I added it to the
    if (element.type == ‘checkbox’ || element.type == ‘radio’) {
    condition, it wasn’t doing anything until I realized that I was using drop downs for my custom options. Once I added your line of code to the
    if (element.options)
    condition, a few lines down in the code, it worked like a charm.


  6. Hello. I do not have the options.html file in my theme folder

    The code listed above is not in my options.phtml in the base directory I do have this code anywhere in this file:
    price += parseFloat(config[optionId][element.getValue()]);

    On line 123 I have if (element.type == ‘checkbox’ || element.type == ‘radio’) {

    Please help I need to get this store launched.

  7. Hi,
    base price = $1000
    option 1 + $100
    option 2 + 5%
    = $1150 (instead of $1155);

    How to calculate price based on total price or final price instead of base price?
    Please help asap


  8. Thanks you so much for this !! 🙂

    You can also try to put your code into


    Line no 143

    price += parseFloat(this.config[optionId][selectOption.value].price);

  9. Thank u for price += parseFloat(this.config[optionId][selectOption.value].price);
    its worked well. and i need one more help. I want to get custom option value which entered by customer. how to get the value? pls guide me?

  10. Been looking for this fix for over 2.5 hours. This fixed it and Dan had my same issue with custom options as dropdowns. Thanks for everyone’s additions to allow me to solve my issue. I’m using the free mobile theme called black_yellow that has this bug of the price resulting to $0.00 when a custom options with a price was chosen.

  11. hello, friends, I want to know how to update custom option price , i want to add my custom value to product price like custom options does.

  12. For those who don’t have the mentioned lines in the options.phtml (like me – are there really two different versions of Magento, you can adjust the file js/varien/product.js.
    In lines 693 and 694 you have the following code:
    subPrice += parseFloat(el.price);
    subPriceincludeTax += parseFloat(el.price);

    Replace this with the following code:
    if (!isNaN(parseFloat(el))) {
    subPrice += parseFloat(el);
    subPriceincludeTax += parseFloat(el);
    } else {
    subPrice += parseFloat(el.price);
    subPriceincludeTax += parseFloat(el.price);

    If you are using prices without tax and with tax, you might have to modify the lines before accordingly.

  13. Could it actually be the scpotions.phtml file? I can’t find the above-mentioned code in options.phtml, but I can find it in scptoptions.phtml.

    I am also using the Simple Configurable Products extension, if that helps.

  14. i use advance product custom option but one proble create total price it should not show in decimal format so please send me any solution and also i can remove + price from dropdown list so how to is possible

Leave a Reply

Your email address will not be published.