# Update mini cart in header

**URL:** <https://forum.pinegrow.com/t/update-mini-cart-in-header/8709>\
**Category:** WooCommerce\
**Tags:** wordpress\
**Created:** [February 15, 2024, 6:10pm UTC](https://forum.pinegrow.com/t/update-mini-cart-in-header/8709 "2024-02-15T18:10:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)\
**Post date:** [February 15, 2024, 6:10pm UTC](https://forum.pinegrow.com/t/update-mini-cart-in-header/8709/1 "2024-02-15T18:10:25Z")

</div>

Hi,

I have a cart icon plus amount of items in cart in the header.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/5/53457bf348232aa5bdfa3eb35d1c6bb253cefb4f.png)

This doesn’t update if i enable ajax on shop page:  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/3/3960f7f998cbdedac55c9465eb06dc9cf3a789a8.png)

Then i also noticed that the items don’t update when you are in the cart page and changing quantities or click remove item.  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/5/5866ca359c222a6be793d15cf79cdbb8fcb83e62.png)

It seems the items in the mini cart only update on page refresh. How can we make it so that the items in the mini cart are updated when adding to cart (ajax), change quantity in cart and remove item in cart?

PS: Using the Pinegrow WordPress plugin.

Thanks  
Guido

---

<div class="post-metadata">

**Author:** ![matjaz](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/matjaz/32/5_2.png) [@matjaz](https://forum.pinegrow.com/u/matjaz)\
**Post date:** [February 29, 2024, 9:55am UTC](https://forum.pinegrow.com/t/update-mini-cart-in-header/8709/2 "2024-02-29T09:55:02Z")

</div>

@Guido not a direct PG solution, but this might be useful:

> <https://stackoverflow.com/questions/49941502/refresh-update-minicart-with-ajax-in-woocommerce>

The selectors that should be updated need to be registered with the  
woocommerce\_add\_to\_cart\_fragments hook.

---

<div class="post-metadata">

**Author:** ![Guido](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/guido/32/4958_2.png) [@Guido](https://forum.pinegrow.com/u/Guido)\
**Post date:** [February 29, 2024, 2:17pm UTC](https://forum.pinegrow.com/t/update-mini-cart-in-header/8709/3 "2024-02-29T14:17:14Z")

</div>

Hi @matjaz

Yes i tried a couple of codes that i found online but none of them actually worked properly. But didn’t tried the one you shared.

For now i just decided to go full block theme and use the mini cart block from WooCommerce in the header. Does exactly what i want out of the box! So that’s great. 😉

Thanks  
Guido
