How to reformat product price in Squarespace
To reformat product price from 15,000.00 to 15000.
Paste the code below in your code injection footer.
<!-- Reformat Product Price (15,000.00 -> 15000 or 15,000.00 -> 15,000) --> <!-- Author: Dmytro Kyselov https://dmytrokyselov.com/ --> <script src="https://cdn.jsdelivr.net/npm/@ryanmorr/ready@1.4.0/dist/ready.umd.js"></script> <script>function reformatPrice_(e=!1){ready(".product-price:not(.product-price-clone),.original-price:not(.product-price-clone)",(function(t){const n=t.cloneNode(!0);function o(){n.innerHTML=t.innerHTML;const e=n.querySelector(".sqs-money-native")||n,o=n.querySelector(".sqs-money-native");e.textContent.length>1?e.textContent=r(e.textContent):o&&(o.textContent=r(o.textContent))}function r(t){return t=t.replace(/\.\d{2}/,""),e||(t=t.replace(",","")),t}n.classList.add("product-price-clone"),t.parentNode.insertBefore(n,t.nextElementSibling),t.style.display="none",o(),new MutationObserver(o).observe(t,{childList:!0})}))} // To keep the comma and replace only the decimals, replace the line below reformatPrice_() with reformatPrice_(true) reformatPrice_() </script> <!-- end Reformat Product Price -->