Shopify themes, liquid, logos, and UX
hey ! i have just changed the cart icon svg but after this the number of products added on the baskets didn't appear on the new cart icon:
i have changed the svg directly on the icon-cart.svg file.
how can i fix this ?
theme: studio
website: utopia-paris.fr
thanks !!
Hi @UTOPIA-PARIS, Here's a simple way to fix the issue so your cart icon shows the product count again:
1. Find Where the Cart Icon is Used:
2. Locate the Cart Code:
{% render 'icon-cart' %}
Right after the cart icon code, add this line:
<span class="cart-count" data-cart-count="{{ cart.item_count }}"></span>
The updated code might look like this:
<div class="cart-icon-wrapper">
{% render 'icon-cart' %}
<span class="cart-count" data-cart-count="{{ cart.item_count }}"></span>
</div>
4. Check the CSS:
.cart-count {
background: red;
color: white;
border-radius: 50%;
padding: 4px 8px;
font-size: 12px;
position: absolute;
top: -5px;
right: -5px;
}
5. Save and Test
This approach adds the missing product count placeholder and ensures it works even with your new cart icon. Let me know if you need further help!
hey ! it's not working because my code about the cart icon look like this :
<a href="{{ routes.cart_url }}" class="header__icon header__icon--cart link focus-inset" id="cart-icon-bubble">
<span class="small-hide">{{ 'templates.cart.cart' | t }}</span>
{% if cart == empty %}
<span class="svg-wrapper">{{'icon-cart-empty.svg' | inline_asset_content }}</span>
{% else %}
<span class="svg-wrapper">{{'icon-cart.svg' | inline_asset_content }}</span>
{% endif %}
<span class="visually-hidden">{{ 'templates.cart.cart' | t }}</span>
{%- if cart != empty -%}
<div class="cart-count-bubble">
{%- if cart.item_count < 100 -%}
<span aria-hidden="true">{{ cart.item_count }}</span>
{%- endif -%}
<span class="visually-hidden">{{ 'sections.header.cart_count' | t: count: cart.item_count }}</span>
</div>
{%- endif -%}
</a>
so i how can i match this code with you're ?
Hey Community! As we jump into 2025, we want to give a big shout-out to all of you wh...
By JasonH Jan 7, 2025Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024