Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Need help for custom code on free product pricing


petibalt
Go to solution Solved by petibalt,

Question

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.

capture-decran-2018-06-06-a-185652.png.7b9a61ab356505990d4599a6ddb94630.png

capture-decran-2018-06-06-a-234755.png.88c6f22aeaf70e62a0619db409aed528.png

Edited by petibalt
Initial Revision
Link to post
  • Answers 3
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

Posted Images

3 answers to this question

Recommended Posts

  • 0

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 post
Guest
This topic is now closed to further replies.

×
×
  • Create New...