Jump to content

Change "You have nothing in your shopping cart" text

Go to solution Solved by tuanphan,

Recommended Posts

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>


Edited by jackcavell
Initial Revision
Link to comment
  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

@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

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
  • 1 year later...
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

Greeting, it's BeyondSpace, I am Squarespace dev focus on provide solutions to enhance feature that squarespace.com can't provide.
Feel free to check my current Squarespace Plugins Developement: Enable Pinch/Zoom on lightbox, Delivery Date Picker, Keyword Highlighter
If you find my answer fit your need, let's leave a like or upvote so others with the same issue can find their solution. Thank you

Link to comment
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. 

Improve your online store with our extensions.
About: Squarespace Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Developer and founder of SF Digital, building the features Squarespace didn't include™.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

Buy me a coffee

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.