storefront icon indicating copy to clipboard operation
storefront copied to clipboard

Allow styling of cart (mobile item count icon) based on empty/full state or number of items

Open uok opened this issue 5 years ago • 3 comments

My suggestion is to add a data attribute, e.g. data-count, to this tag to allow easy conditional styling when 1 or more item has been added to cart.

https://github.com/woocommerce/storefront/blob/d5266033f55f13c64d7eaa6935cf4ab926e6ef1b/inc/woocommerce/storefront-woocommerce-template-functions.php#L683

Example footercart

uok avatar Sep 08 '19 13:09 uok

@uok can you please elaborate a bit further? I believe the styling of the count icon is already possible:

/* Changes the color of the cart count of the handheld menu cart item on mobile devices */
.storefront-handheld-footer-bar ul li.cart .count {
    background-color: red;
}

Result:

red_black

juliaamosova avatar Nov 15 '19 14:11 juliaamosova

the idea was to have another color for the count, once an item has been added to cart. 0 = black, 1 or more e.g. orange

uok avatar Nov 17 '19 11:11 uok

the idea was to have another color for the count, once an item has been added to cart. 0 = black, 1 or more e.g. orange

I see, so you would like to style the cart count differently depending on the number of items? To clarify this I've retitled the issue and tagged this as Enhancement.

haszari avatar Dec 08 '19 22:12 haszari