Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search
  • 0

Change "You have nothing in your shopping cart" text


jackcavell

Question

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
  • Answers 5
  • Created
  • Last Reply

Top Posters For This Question

Top Posters For This Question

5 answers to this question

Recommended Posts

  • 1

@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
  • 0
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 BaNgan from 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, Youtube Gallery for Squarespace
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
  • 0
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. 

About: Sqsp Circle Leader since 2017. I value honesty, transparency, appreciation and great design ♥.
Work: Squarespace Expert and founder of 
SF Digital, a company dedicated to improving websites by building the features Squarespace didn't include™. See our range of extensions to improve your online store.
Content: Links in my posts may refer to SF Digital products or may be affiliate links.

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