Jump to content

How to Change "add to cart" button on Product Block for Sold Out Product

Recommended Posts

I use product blocks throughout my art website. I don't like the individual product pages as each product typically has other products that specifically pertain to it and so it was just easier to use blocks.

However, at the moment, even if an item is sold, it's "add to cart" button still says "purchase" until you click the button and then it says sold out. Is there a css code for the button to just automatically be replaced with "SOLD OUT" if the item quantity falls to zero?

Included is a test webpage. 

Screen Shot 2023-09-13 at 12.46.24 PM.png

Screen-Shot-2023-09-12-at-4.27.36-PM2.jpg

 

**UPDATE**

https://www.pashapashanewyork.com/new-page-2

Actually if I could get a little bit of help again, it looks like the "SOLD OUT" only replaces the button when I feature the product image as well? As seen on the page above, both products are actually sold out however the product block where only the button is shown still says "Add to Cart". Is there a way for this code to work also when there is just the button without the product image?

Edited by pashapasha1570048753
Link to comment
  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

On 9/13/2023 at 3:55 PM, Web_Solutions said:

 Add the code below on Custom CSS panel in Website Utilities Website Tools > Custom CSS.

.product-block:has(.sold-out) {
  .sqs-add-to-cart-button {
    background: #000;
    .sqs-add-to-cart-button-inner {
      display: none;
    }
  }
  .sqs-add-to-cart-button:after {
    content: "SOLD OUT";
    color: #fff;
  }
}

 

Actually if I could get a little bit of help again, it looks like the "SOLD OUT" only replaces the button when I feature the product image as well? As seen on the page above, both products are actually sold out however the product block where only the button is shown still says "Add to Cart". Is there a way for this code to work also when there is just the button without the product image?

https://www.pashapashanewyork.com/new-page-2

Link to comment
  • 3 weeks later...
On 10/18/2023 at 10:59 PM, pashapasha1570048753 said:

I see you figured it out how to change it to Sold out?

image.png.07c31fcab193b9c167455afe8de0a61e.png

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
On 10/21/2023 at 7:30 AM, tuanphan said:

I see you figured it out how to change it to Sold out?

image.png.07c31fcab193b9c167455afe8de0a61e.png

It looks like the "SOLD OUT" only replaces the button when I feature the product image as well? As seen on the page above, both products are actually sold out however the product block where only the button is shown still says "Add to Cart". Is there a way for this code to work also when there is just the button without the product image?

Link to comment
On 10/26/2023 at 1:03 AM, pashapasha1570048753 said:

It looks like the "SOLD OUT" only replaces the button when I feature the product image as well? As seen on the page above, both products are actually sold out however the product block where only the button is shown still says "Add to Cart". Is there a way for this code to work also when there is just the button without the product image?

You mean change this to Sold out?

image.png.71f0fb411a169ebbabf9be4c1c2a3f2b.png

You can add this to Website Tools (under Not Linked) > Custom CSS
 

div#block-yui_3_17_2_1_1695745135102_2127 {
.sqs-add-to-cart-button-inner {
    font-size: 0;
}
.sqs-add-to-cart-button-inner:before {
    content: "Sold Out";
    font-size: 14px;
    white-space: nowrap;
    position: relative;
    top: 2px;
}}

 

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

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