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

How to remove trailing decimal .00's from product pricing


MarikaS

Question

Hi there. I use the Adirondack template for my site and am wanting to remove the trailing decimal 00's from my pricing.

For example I want $249.00 to display as $249.

Any idea how to make this happen? Any help would be much appreciated, thanks!

Link to post
  • Answers 11
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Popular Posts

You can do it with the code that @brandon provided here: http://squarespace.cloud.answerhub.com/questions/152145/can-someone-help-me-change-coding-to-get-rid-of-de.html  

Thank you so much @paul2009 and @brandon. Worked a treat!

Good find @paul2009. That's an example of code I don't even remember writing. One time I went looking for a coding solution I couldn't solve, and was happy when I found it on Answers. Then I realized

11 answers to this question

Recommended Posts

  • 0

sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digitalbuilding the features that Squarespace didn't include. Pick dates in any format, show prices in other currencies, take orders without payment or improve your cartI value honesty, integrity, transparency and respect. Links in my posts may refer to SF Digital products or may be affiliate links.  Squarespace. I've been a loyal supporter of the platform since 2007. 

Link to post
  • 0

Good find @paul2009. That's an example of code I don't even remember writing. One time I went looking for a coding solution I couldn't solve, and was happy when I found it on Answers. Then I realized it was my own answer...

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

Link to post
  • 0

Been there too @Brandon!

The Community team have now imported the old Answers post 👍

 

sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digitalbuilding the features that Squarespace didn't include. Pick dates in any format, show prices in other currencies, take orders without payment or improve your cartI value honesty, integrity, transparency and respect. Links in my posts may refer to SF Digital products or may be affiliate links.  Squarespace. I've been a loyal supporter of the platform since 2007. 

Link to post
  • 0

Thanks @brandon and @paul2009 for this code! It works perfectly when I first save it in the foot code injection, but as soon as I refresh a page, it reverts to the normal pricing with decimals again. I wonder if it's because our prices are in £ rather than $. I've tried swapping the currencies out in the code but I really don't know what I'm doing! Any ideas how I could get it to work?

Here's an example of what I'm working with: https://ellishampers.co.uk/hampers/magnificent-n8-the-marvel

 

UPDATE:

Just checked that the above linked worked and the decimals had disappeared! Tried in incognito and they came back again. It seems that if I refresh the page the code works, but the first time I load it the decimals are always there. In normal browsing (not incognito), the same applies but every time you load the page, you also see the decimals briefly before they disappear. Worth putting the code in the header for this or is that something that could go wrong?

Thank you! 😊

Edited by EllisCo
Link to post
  • 0

The code was written in 2016 and like many of the older code samples provided on forums, it therefore understandably doesn’t take into account the introduction of Ajax on many Squarespace templates since that time. Turning off Ajax in Site Styles will fix this but it’s just a workaround. A better solution is to replace

(function() {

with

window.Squarespace.onInitialize(Y, function() {

If like me you’d like to understand why, I wrote an explanation here: https://sf.digital/squarespace-solutions/why-doesnt-my-code-work-until-i-refresh-the-page

Edited by paul2009

sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digitalbuilding the features that Squarespace didn't include. Pick dates in any format, show prices in other currencies, take orders without payment or improve your cartI value honesty, integrity, transparency and respect. Links in my posts may refer to SF Digital products or may be affiliate links.  Squarespace. I've been a loyal supporter of the platform since 2007. 

Link to post
  • 0

Hi, thank you very much for this solution, I've found this to work great for me as well apart from a single instance when I choose two variables of a product to add to cart - such as a size and a color. When two variables are chosen, suddenly the two decimals appear again. Any idea why that might be and if there's a way to solve this?

Link to post
  • 0

 

sf-digital-signature-logo-email145.png.46606a2288a2847f44d81b9b7b58f3a5.png
Hi, I'm Paul, founder of SF Digitalbuilding the features that Squarespace didn't include. Pick dates in any format, show prices in other currencies, take orders without payment or improve your cartI value honesty, integrity, transparency and respect. Links in my posts may refer to SF Digital products or may be affiliate links.  Squarespace. I've been a loyal supporter of the platform since 2007. 

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...