I have this snippit of code below, And when I try to add a XX item to the store, it is adding $9 to the price not $2.00 When I add a XXX item it is adding $12 to the item. I have never really learned much javascript, and this is my first time fooling with simpleCart.JS The documentation is right here. http://simplecartjs.org/documentation/beforeadd-event Any Help is appreciated. simpleCart.bind( 'beforeAdd' , function( item ){ if( item.get( 'size' ) == 'XX'){ item.price( item.price() + 2.00 ); } if( item.get( 'size' ) == 'XXX'){ item.price( item.price() + 3.00 ); } if( item.get( 'size' ) == 'XXXX'){ item.price( item.price() + 4.00 ); } }); Code (JavaScript):
looks like your item.price() is a getter+setter function, so you could be (probably are) updating the central storage location of the item's price each time this set of IFs gets called with a new item to add to the basket.. what you need to do is to replace "item.price()" with the variable containing the base price of the item in question (which you should have somewhere, so stick that in a global "inventory" array of items for the entire webshop)