petibalt Posted June 6, 2018 Share Posted June 6, 2018 Hey guys, I'm French so I'm sorry if I'm not all clear but thanks anyway for your help. I just want to add a custom label for free products with "GRATUIT (FREE)" in it. I just run some test but it applies on every product so I'm looking for something to add in code injection like "IF price_variable IS EQUAL '0.00' THEN SHOW 'FREE' (instead of €0.00)" I hope that I'm as clear as possible. Here is a screenshot for those who don't understand. Link to comment
dimsk Posted June 7, 2018 Share Posted June 7, 2018 Hi @petibalt Paul2009 has a great answer for this here: https://answers.squarespace.com/questions/176452/change-display-of-price-when-item-is-000.html Hope that helps! Link to comment
petibalt Posted June 8, 2018 Author Share Posted June 8, 2018 Thanks @DMK Squarespace has changed Brine code so the code above isn't working. The new code to make it work is: <script> //Where products have 0.00 price, change to FREE var products = document.querySelectorAll('.ProductItem, .ProductList-item'), i, len = products.length; for (i=0; i<len; i++) { var price = products[i].querySelector('.sqs-money-native'); if (price.textContent === '0.00') { price.parentNode.textContent = 'FREE'; } } </script> Link to comment
dimsk Posted June 8, 2018 Share Posted June 8, 2018 ah great, thanks for letting me know! Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.