Display Cart Info only IF there are Items in Cart

Tourist
31 0 1

I'm trying to display the cart info on every page only once an item has been added to the cart.

Here's my archaic attempt (which isn't working) in the STYLE.CSS.LIQUID:

 

#cart-summary {
	position:absolute;
	right:0px;
	{% if cart.item_count == '0' %} 
	display:none !important;
	{% endif %}
}

 

 

0 Likes
Shopify Staff
Shopify Staff
489 0 32

Hey Ulas,

You cannot access cart.item_count from Liquid CSS files. The best thing to do would be to wrap the cart count div in theme.liquid. For example:

 

{% unless cart.item_count == 0 %}
<div id="cart-summary">
   cart stuff here
</div>
{% endunless %}

Cheers,

Tetchi

www.tetchi.ca | www.twitter.com/t3tchi
0 Likes
Tourist
31 0 1

NICE It works :)

0 Likes
New Member
1 0 0

We wish to do exactly the same, however at the moment we don't have any cart that shows on any of our pages. The theme is Blockshop. Help would be highly appreciated. Thank you x

0 Likes