Guest Posted August 31, 2016 Share Posted August 31, 2016 (edited) 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 September 1, 2016 by bahamascollective Link to comment
brandon Posted August 31, 2016 Share Posted August 31, 2016 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' (top-left) Link to comment
Guest Posted September 1, 2016 Share Posted September 1, 2016 LOL genius. @brandonW thank you. Whitebarkworkwear.com Link to comment
Guest Posted September 1, 2016 Share Posted September 1, 2016 LOL genius. @brandonW thank you. Whitebarkworkwear.com Link to comment
brandon Posted September 1, 2016 Share Posted September 1, 2016 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. chelle_k and dhob 1 1 If a response helped you out, send a 'Like' 👍 (bottom-right) and/or 'Upvote' (top-left) Link to comment
Guest Posted September 1, 2016 Share Posted September 1, 2016 @brandonw you're a champion.. thanks man Link to comment
brandon Posted September 1, 2016 Share Posted September 1, 2016 Nice! If it works for you, please accept the answer. If a response helped you out, send a 'Like' 👍 (bottom-right) and/or 'Upvote' (top-left) Link to comment
jjjuliejj Posted May 1, 2020 Share Posted May 1, 2020 Does anyone know how to remove the ".00" from all prices throughout a 7.1 site (including cart)? Thank you! Evelina 1 Link to comment
jjjuliejj Posted May 3, 2020 Share Posted May 3, 2020 Hi Brandon -- Can you update the code for 7.1? We would like to eliminate the decimal place and trailing zeros. Thank you. nirajshah22 1 Link to comment
tuanphan Posted January 23, 2021 Share Posted January 23, 2021 On 1/20/2021 at 8:30 PM, Evelina said: following up Can you share link to a product? We can help easier Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Evelina Posted January 28, 2021 Share Posted January 28, 2021 On 1/23/2021 at 11:59 AM, tuanphan said: Can you share link to a product? We can help easier It s for all the products in this shop https://www.moderncharcuterie.co/shop-charcuterie-boards Thank you! Link to comment
tuanphan Posted February 2, 2021 Share Posted February 2, 2021 On 1/28/2021 at 7:15 AM, Evelina said: It s for all the products in this shop https://www.moderncharcuterie.co/shop-charcuterie-boards Thank you! Add to Code InjectionFooter <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> Evelina, Jackie123 and CassAggett 3 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Evelina Posted February 2, 2021 Share Posted February 2, 2021 works perfectly thank you! Link to comment
joelygoe Posted February 15, 2021 Share Posted February 15, 2021 This doesn't work in Quick view Link to comment
joelygoe Posted February 15, 2021 Share Posted February 15, 2021 This doesn't work in the Quickview Link to comment
tuanphan Posted February 18, 2021 Share Posted February 18, 2021 On 2/16/2021 at 12:49 AM, joelygoe said: This doesn't work in Quick view Yes. Quick view needs a different code. Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
joelygoe Posted February 18, 2021 Share Posted February 18, 2021 8 hours ago, tuanphan said: Yes. Quick view needs a different code. Any idea what that code is? Any way to make it more site-wide as surely it is as universal as say the currency symbol?! So anywhere their is a price show XXXXX Link to comment
MarikaS Posted April 27, 2021 Share Posted April 27, 2021 @brandon this worked a treat on my product listing, however the .00s come back when a product variant like size etc is selected from the dropdown any way of doing a workaround for this? link to one of my product pages below. thanks! https://www.svikis.com/shop/circle-statement-ring-sterling-silver Link to comment
MarikaS Posted April 27, 2021 Share Posted April 27, 2021 @brandon I've also realised that I have to reload my product pages for the .00s to disappear - any idea why that would happen? Link to comment
tuanphan Posted April 28, 2021 Share Posted April 28, 2021 16 hours ago, MarikaS said: @brandon I've also realised that I have to reload my product pages for the .00s to disappear - any idea why that would happen? Design > Site Styles > Disable Ajax Loading creedon and MarikaS 2 Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
ievavi Posted June 3, 2021 Share Posted June 3, 2021 On 9/1/2016 at 2:59 AM, brandon said: 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 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. The code works great until you have to select a variant. Would anybody be able to help in making decimals stay once you select a variant? Website for the reference: https://rocksforlife.com/our-jewellery/no-1-solitaire-ring-white-gold All insights are very much appreciated! Maybe @brandon? Link to comment
ievavi Posted June 3, 2021 Share Posted June 3, 2021 On 2/2/2021 at 3:46 PM, tuanphan said: Add to Code InjectionFooter <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> The code works great until you have to select a variant. Would anybody be able to help in making decimals stay once you select a variant? Website for the reference: https://rocksforlife.com/our-jewellery/no-1-solitaire-ring-white-gold All insights are very much appreciated! Link to comment
paul2009 Posted June 3, 2021 Share Posted June 3, 2021 (edited) See: https://www.sqspthemes.com/blog/how-to-reformat-product-price-in-squarespace Update: Please note that answers provided earlier than 23 August 2022 no longer function. This is due to a Squarespace update on this date. Edited September 12, 2022 by paul2009 SBWL 1 Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥. Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links. Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional. Would you like your customers to be able to mark their favourite products in your Squarespace store? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment