Jump to content

Saffra

Member
  • Posts

    1
  • Joined

  • Last visited

Everything posted by Saffra

  1. Hi there! I've tried tried your code Creedon but for me it doesn't seem to work. Worth mentioning is that I know zero about JavaScript, so troubleshooting for me is difficult (even with AI apparently). However this code (injected in Code Injection -> Footer) removes the "," but keeps the zeros aferwards. I want to remove the entire ",00". The price is in SEK, I don't know if that might effect the outcome. The website: https://www.zsuzsannalendemar.com/ Note! Until this problem is solved I have used the code underneith and devided every price with 100 as I type it in to have it displayed the way I want. It's not very convenient though. The code: <!-- Reformat Product Price (15,000.00 -> 15000) --> <!-- Author: Dmitry Kiselyov @_dmitrykiselyov --> <script src="https://cdn.jsdelivr.net/npm/@ryanmorr/ready@1.4.0/dist/ready.umd.js"></script> <script>!function(){function reformatPrice(price){var priceClone=price.cloneNode(!0);function reformat(){priceClone.innerHTML=price.innerHTML;var target=priceClone.querySelector(".sqs-money-native")||priceClone,textNode=priceClone.querySelector(".sqs-money-native");target.textContent.length>1?target.textContent=format(target.textContent):textNode&&(textNode.textContent=format(textNode.textContent))}function format(text){return text.replace(",","").replace(/\.\d{2}/,"")}function watch(){var observer;new MutationObserver(reformat).observe(price,{childList:!0})}priceClone.classList.add("product-price-clone"),price.parentNode.insertBefore(priceClone,price.nextElementSibling),price.style.display="none",reformat(),watch()}ready(".product-price:not(.product-price-clone),.original-price:not(.product-price-clone)",reformatPrice)}();</script> <!-- end Reformat Product Price --> Any help out there?
×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.