Skip to content

Instantly share code, notes, and snippets.

@SmellyFish
Last active December 28, 2015 01:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SmellyFish/7420007 to your computer and use it in GitHub Desktop.
Save SmellyFish/7420007 to your computer and use it in GitHub Desktop.
jQuery code to remove decimals on the front end.
jQuery(function(){
$('.sprice, #price, #cartItems .list, #orderDetails .list, #orderList tr td').each(function(){
cleanPriceText($(this));
});
});
function cleanPriceText($ele){
var text;
text = $ele.text();
text = text.replace(/(\$[0-9\.\,\s]+)\.00/g, '$1');
$ele.text(text);
}
function customProductDetailChangePriceHandler(){
cleanPriceText($('#price'));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment