Jump to content

Change "You have nothing in your shopping cart" text

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>


Link to comment
  • Replies 5
  • Views 2.5k
  • Created
  • Last Reply

@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!)

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

BeyondSpace - Squarespace Website Developer

🖼️ Lightbox Studio (Enable Pinch/Zoom on lightbox)
🗓️ Delivery Date Picker (Squarespace Date picker form field)
💫 Gallery block 7.1 workaround
🥳 Sparkplugin Customisations Browsers (Browse +100 Spark plugin customisations)
🥳 Elfsight Template Browsers (Browse +1000 Elfsight widget Templates)

If you find my answer useful, 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. 

About me: I'm Paul, a SQSP user for over 18 yrs and a Circle Leader since 2017. I value honesty, transparency, diversity and good design ♥.
Work: Founder of SF.DIGITAL, providing 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 below. Buying a coffee is optional.

Book paid help with domains: Connect a GoDaddy domain. Connect a Squarespace Domain. Domain assistance

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.