Jump to content

How can I hide the ecommerce cart when it is empty?

Go to solution Solved by brandon,

Recommended Posts

  • Solution

Something simple like this should work:

.Cart[aria-label^='0'], .Cart:not([aria-label]) {
  display: none;
}

Let me know how that works for you. It's not something I heavily tested. If it does work, it could be modified using opacity and transitions instead.

Related:

Also, is it just me or is there no way to get to the checkout on mobile using the Foster template? Using the demo site, there was no link to the checkout at any point in my mock-shopping.

-Brandon

Edited by brandon

If a response helped you out, send a 'Like' 👍 (bottom-right) and/or 'Upvote' vote.jpg.c260784ece77aec852b0e3049c77a607.jpg (top-left)

Link to comment

Great use of the accessibility attribute 🙂

 

On 10/29/2019 at 1:01 PM, brandon said:

is it just me or is there no way to get to the checkout on mobile using the Foster template

It's an unfortunate setting for a Squarespace demo! They've set MOBILE: CART to Position: Hide in Site Styles.

Edited by paul2009

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
  • 1 month later...
  • 3 months later...
On 10/30/2019 at 12:01 AM, brandon said:

Something simple like this should work:


.Cart[aria-label^='0'], .Cart:not([aria-label]) {
  display: none;
}

Let me know how that works for you. It's not something I heavily tested. If it does work, it could be modified using opacity and transitions instead.

Related:

Also, is it just me or is there no way to get to the checkout on mobile using the Foster template? Using the demo site, there was no link to the checkout at any point in my mock-shopping.

-Brandon

@brandon Thank you so much for this super simple clean code! It works perfectly on Maple, Brine 🙂

Edited by Agnieszka
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.