Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0
bahamascollective

Can someone help me change coding to get rid of decimal places in my pricing?

Question

I would like to get rid of the decimals after my whole dollar amount on my product pricing. There is currently no option for that.Http://whitebarkworkwear.com

thank you

Edited by bahamascollective

Share this post


Link to post

7 answers to this question

Recommended Posts

  • 1

Hi. The following Javascript, inserted via footer code injection should do the trick:


<script>
   (function() {
       var prices = document.getElementsByClassName('sqs-money-native');
   var thisPrice;
   var i, I;
   for (i=0, I=prices.length; i<I; i++) {
       thisPrice = prices[i];
       thisPrice.innerHTML = thisPrice.innerHTML.replace(/(\.[0-9]*?)0+$/, "$1").replace(/\.$/, ""); //http://stackoverflow.com/questions/1015402/1015434#1015434
   }
   })();
</script>

I didn't test this throughout your site...just checked a couple pages. Do let me know if this works for you.

-Brandon


If this or any other answer helps you out, please give credit where credit is due: Accept the answer if you're the poster or Up-Vote the answer if you're not the poster. If it didn't help, feel free to inquire further or wait and see what others have to say. Code is provided without any warranty, expressed or implied.


If a response helped you out, send a 'Like' 👍 (bottom-right) and/or 'Upvote' vote.jpg.c260784ece77aec852b0e3049c77a607.jpg (top-left)

Share this post


Link to post
  • 2

Hi Brandon -- Can you update the code for 7.1?  We would like to eliminate the decimal place and trailing zeros.  Thank you.

Share this post


Link to post
  • 0

Hi .While not necessary, a link to a page on your site that shows the elements you'd like changed may help others offer help.


If a response helped you out, send a 'Like' 👍 (bottom-right) and/or 'Upvote' vote.jpg.c260784ece77aec852b0e3049c77a607.jpg (top-left)

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...