# Sending Cart Information to the Header

**URL:** <https://forum.shopware.com/t/sending-cart-information-to-the-header/90584>\
**Category:** Programming (EN)\
**Tags:** general, programming\
**Created:** [28. September 2021 um 11:12 UTC](https://forum.shopware.com/t/sending-cart-information-to-the-header/90584 "2021-09-28T11:12:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![FinnMac](https://avatars.discourse-cdn.com/v4/letter/f/8e7dd6/32.png) [@FinnMac](https://forum.shopware.com/u/FinnMac)\
**Post date:** [28. September 2021 um 11:12 UTC](https://forum.shopware.com/t/sending-cart-information-to-the-header/90584/1 "2021-09-28T11:12:23Z")

</div>

I am trying to implement a unit quantity notifier in the header, that displays the number of items currently in the cart. I have set up two successful services, one that sends data to the header when there is a HeaderPageletLoadedEvent, and the other to pull data from the cart when there is a CartChangedEvent.

The issue is that I cannot seem to save the event / page details of the Header during the CartChangedEvent, and vice versa, as these seem to access the service page independently of each other. As a result, I am not sure how I am supposed to send the cart content information to the header.

Any ideas on how to do this?

---

<div class="post-metadata">

**Author:** ![Max\_Shop](https://avatars.discourse-cdn.com/v4/letter/m/58f4c7/32.png) [@Max\_Shop](https://forum.shopware.com/u/Max_Shop)\
**Post date:** [11. Oktober 2021 um 17:50 UTC](https://forum.shopware.com/t/sending-cart-information-to-the-header/90584/2 "2021-10-11T17:50:58Z")

</div>

The number of card items should be available in the frontend. Why don’t you use twig to output them?

---

<div class="post-metadata">

**Author:** ![FinnMac](https://avatars.discourse-cdn.com/v4/letter/f/8e7dd6/32.png) [@FinnMac](https://forum.shopware.com/u/FinnMac)\
**Post date:** [26. Oktober 2021 um 08:45 UTC](https://forum.shopware.com/t/sending-cart-information-to-the-header/90584/3 "2021-10-26T08:45:45Z")

</div>

Yes I had seen that code, but it was not displaying, and I was not able to access certain data from the header dump so I assumed it was not working. Removing the class name displayed the cart quantity (although not an accurate one; the amount of individual products were counted, and not the quantity of each product)

---

<div class="post-metadata">

**Author:** ![jonas.joachim](https://avatars.discourse-cdn.com/v4/letter/j/e95f7d/32.png) [@jonas.joachim](https://forum.shopware.com/u/jonas.joachim)\
**Post date:** [26. Oktober 2021 um 08:55 UTC](https://forum.shopware.com/t/sending-cart-information-to-the-header/90584/4 "2021-10-26T08:55:26Z")

</div>

In the worst case check out more invasive stuff like OnGenericPageLoaded (only if necessary), it practically catches everything.
