Jump to content

Change "You have nothing in your shopping cart" text

Recommended Posts

Posted

Website is far from finished but having some trouble with this custom code

https://parakeet-radish-lrza.squarespace.com/cart

My aim is to change the "you have nothing in your shopping cart" text to read "Your collection is currently empty!"

My cart is acting as a collection for clients to view their selected talent, almost like a wishlist

The code below is working, but not every time, then if you refresh the page, it works again. Also if you have people in your cart/collection and then remove them, it again reads "you have nothing in your shopping cart"

Any ideas?


<script>
window.onload = function(){
  if (document.body.classList.contains('show-cart-page')) {
    var pageTitle = document.querySelector('.sqs-shopping-cart-wrapper');
    pageTitle.innerText = "Collection";
    pageTitle.style.opacity = 1; !important }
  if (document.body.classList.contains('has-cart')) {
      var pageDescription = document.querySelector('.empty-message');
      pageDescription.innerText = "Your collection is currently empty!"
      pageDescription.style.opacity = 1;
    }
 };
</script>


  • Replies 5
  • Views 2.7k
  • Created
  • Last Reply
Posted

@jackcavell You can use CSS to change text. Add to Home > Design > Custom CSS


.empty-message {
   visibility: hidden;
}
.empty-message:before {
   visibility: visible;
   content: "New Text Cart";
   font-size: 20px;
}

Reference: https://beaverhero.com/squarespace-all-css

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

  • 1 year later...
Posted

Hi! This worked great for a custom message, but does anyone know if a hyperlink can be inserted?

I'd like to link the customer to a product when they click on the text "gift boxes" in my cart below:

https://www.ganchic.com/cart

Posted
1 hour ago, GCK said:

Hi! This worked great for a custom message, but does anyone know if a hyperlink can be inserted?

I'd like to link the customer to a product when they click on the text "gift boxes" in my cart below:

https://www.ganchic.com/cart

I think can't do with pure css

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Pinch/Zoom images, videos - PDFs Lightbox - ...) </>  🗓️ Delivery Date Picker (Date picker form field)
Gallery block 7.1 workaround </> 🤖 Ask me anything

Posted
6 hours ago, GCK said:

This worked great for a custom message, but does anyone know if a hyperlink can be inserted? I'd like to link the customer to a product when they click on the text "gift boxes"

This could be achieved with some custom JavaScript instead of the CSS, but as the message would only ever been seen on the empty cart page, it may be better to promote your gift boxes using an announcement bar that will be seen on all pages. 

Me: I'm Paul, a SQSP user for >18 yrs & Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL. We provide high quality original extensions to supercharge your Squarespace website. 
Content: Views and opinions are my own. Links in my posts may refer to my own SF.DIGITAL products or may be affiliate links.
Forum advice is completely free. You can thank me by selecting a feedback emoji. Buying a coffee is generous but optional.

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.