Reformat Product Price in 7.1
Look Demo
Simplify the format of any product price. For example, display a product’s price as $8 instead of $8.00. This plugin uses code injection and works with Squarespace 7.1.
How To Install
From your Squarespace account, go to Site Code Injection. Copy and paste the code below into the Footer Code Injection box.
<!-- 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(/\.\dfunction watch(){var observer;new MutationObserver(reformat).observe(price,();</script> <!-- end Reformat Product Price -->
Customize
You do not need to change any of the values or properties.
License
This plugin comes with an Unlimited Use License. View License Terms