Cart won't Auto Update after using Ajaxify

Solved
Highlighted
New Member
10 0 0

Hi! I am using jumpstart theme and I want that after clicking the Add to Cart to Page it will just stay on whatever the page the user is in.

I have followed this tutorial https://help.shopify.com/en/themes/customization/products/add-to-cart/stay-on-product-page-when-item...

The function worked but the issue is that the cart won't update the total items added in the cart, I followed this forum https://community.shopify.com/c/Shopify-Design/AJAXIFY-Add-to-Cart-Doesn-t-Update-the-Cart-Counter-o... but none of the suggestions worked.

 

code in header.liquid

{% if cart.item_count > -1 %}
            <li class="btn__cart">
              <a href="/cart">
                <span class="icon" aria-hidden="true">{% unless cart.item_count > 99 %}{{ cart.item_count }}{% endunless %}{% include 'asset_svg' with 'cart' %}</span>
                <span class="text">{{ 'layout.navigation.shopping_cart' | t }}</span>
              </a>
            </li>
          {% endif %}
cartCountSelector:             '.cart-count, #cart-count a:first, #gocart p a, #cart .checkout em, .item-count',

Hope you can help guys! https://84zmuh900pjv3mgn-26446734.shopifypreview.com

 

 

 

 

 

 

 

0 Likes
Highlighted
Shopify Partner
1166 32 213

This is an accepted solution.

you need to add an element with 'cart-count' class. Try this code instead

{% if cart.item_count > -1 %}
            <li class="btn__cart">
              <a href="/cart">
                <span class="icon" aria-hidden="true">

<span class="cart-count">{% unless cart.item_count > 99 %}{{ cart.item_count }}{% endunless %}</span>

{% include 'asset_svg' with 'cart' %}
</span>
                <span class="text">{{ 'layout.navigation.shopping_cart' | t }}</span>
              </a>
            </li>
          {% endif %}

 

- Was my reply helpful? Click Like to let me know!
- Was your question answered? Click Accept as Solution
- Available for hiring. lixon@ecommercestudio.in
0 Likes
Highlighted

It's not working for my site. https://www.incensepro.com/

Jewel
0 Likes
Highlighted
New Member
18 0 0

I have the same problem. But I don't have the that code in mine. I'm using Debut theme. I searched in header.liquid. Mine looks like this:

<a href="{{ routes.cart_url }}" class="site-header__icon site-header__cart">
{% include 'icon-cart' %}
<span class="icon__fallback-text">{{ 'layout.cart.title' | t }}</span>
<div id="CartCount" class="site-header__cart-count{% if cart.item_count > -1 %} hide{% endif %}" data-cart-count-bubble>
<span data-cart-count>{{ cart.item_count }}</span>
<span class="icon__fallback-text medium-up--hide">{{ 'layout.cart.items_count' | t: count: cart.item_count }}</span>
</div>
</a>

Hope you could help. 

0 Likes