Jump to content

Hide Add to Cart button for Products with $0 price

Recommended Posts

Posted

Site URL: https://www.ffp.com.au

Hi I am wanting to hide the add to cart button for all products that have a $0 price. 
I have used javascript to change the price ($0) to display POA instead but I'm not sure what extra coding I need to add to hide the Add to Cart button on these items.

The javascript I am using is - 

<script>
  /* Brine: Change 0.00 prices to POA */
window.Squarespace.onInitialize(Y, function(){
  var products = document.querySelectorAll('.ProductItem, .ProductList-item'), i, len = products.length;
  for (i=0; i<len; i++) {
    var price = products.querySelector('.sqs-money-native');
    if (price.textContent === '0.00') {
      price.parentNode.textContent = 'POA';  
    }
  }
});
</script>

 

Any help is much appreciated.

  • Replies 1
  • Views 620
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.