Jump to content

Hide Add to Cart button for Products with $0 price

Recommended Posts

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.

Link to comment
  • Replies 1
  • Created
  • Last Reply

If you can add tag to all 0$ products, eg tag: zero

you can add this code to Home > Design > Custom CSS to hide add to cart

.tag-zero .sqs-add-to-cart-button-wrapper {
    display: none !important;
}

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment

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.