Cart won't Auto Update after using Ajaxify

Solved
chrissa17
New Member
12 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
Lixon_Louis
Shopify Partner
1186 35 257

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 %}

 

0 Likes

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

Jewel
0 Likes
kdc02
Tourist
18 0 1

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
TheWreckShop
Tourist
8 0 0
Click to expand...
Could you solve your problem?

Theme: Debut

Subject: The Count numbers on the  icon cart HAD SIMPLY VANISHED NOW

Hi! I am using Debut theme.

 I have just learned how to show the “add to cart” icon under each product.

 And I could, as well, update the code using AJAXIFY to stay in the same page after adding the products.

But then, the NUMBER ON MY CART ICON SIMPLY VANISHED.

Please, ANY SUGGESTION?.ANY LINK?

 

0 Likes
TheWreckShop
Tourist
8 0 0

Mine is as well in Debut Theme. Did you find your solution? thank you

0 Likes
chrissa17
New Member
12 0 0

yes, I accepted the solution and the code is above. 

0 Likes