# Why Shopware 6 is caching the events?

**URL:** <https://forum.shopware.com/t/why-shopware-6-is-caching-the-events/65445>\
**Category:** Programming (EN)\
**Created:** [12. März 2020 um 04:35 UTC](https://forum.shopware.com/t/why-shopware-6-is-caching-the-events/65445 "2020-03-12T04:35:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)\
**Post date:** [12. März 2020 um 04:35 UTC](https://forum.shopware.com/t/why-shopware-6-is-caching-the-events/65445/1 "2020-03-12T04:35:10Z")

</div>

Hi

I am creating a plugin. I am using NavigationPageLoadedEvent in my plugin.

But the problem is Shopware cache the events so the events are not working in the dev server.

I have installed the user version of Shopware (6.1.3). and SHOPWARE\_HTTP\_CACHE\_ENABLED is 1.

if I change the SHOPWARE\_HTTP\_CACHE\_ENABLED to 0 it will work.

is there any way to do some functions NavigationPageLoadedEvent even if the Http cache enabled.?

There are no issues with the local installation running on the docker. the events are working even if the&nbsp; SHOPWARE\_HTTP\_CACHE\_ENABLED is 1.&nbsp;

Why is the production server caching the events?

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [12. März 2020 um 06:02 UTC](https://forum.shopware.com/t/why-shopware-6-is-caching-the-events/65445/2 "2020-03-12T06:02:30Z")

</div>

The http cache caches the complete html response, when the http-cache is active you can only use ESI-tags or javascript to change the html output. This is not a shopware issue, but the functionality of the caching itself.

[https://symfony.com/doc/current/http\_cache/esi.html](https://symfony.com/doc/current/http_cache/esi.html)

---

<div class="post-metadata">

**Author:** ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)\
**Post date:** [12. März 2020 um 07:38 UTC](https://forum.shopware.com/t/why-shopware-6-is-caching-the-events/65445/3 "2020-03-12T07:38:13Z")

</div>

> [@Moritz Naczenski schrieb:](https://forum.shopware.com/profile/14574/Moritz%20Naczenski "Moritz%20Naczenski")
> 
> The http cache caches the complete html response, when the http-cache is active you can only use ESI-tags or javascript to change the html output. This is not a shopware issue, but the functionality of the caching itself.
> 
> [https://symfony.com/doc/current/http\_cache/esi.html](https://symfony.com/doc/current/http_cache/esi.html)
> 
> &nbsp;
> 
> I am using ProductEvents::PRODUCT\_SEARCH\_CRITERIA event
> 
> I want to add some conditions to product search and load only the condition satisfied products.
> 
> how to do this with ESI-tags?

---

<div class="post-metadata">

**Author:** ![Moritz\_Naczenski](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/moritz_naczenski/32/7792_2.png) [@Moritz\_Naczenski](https://forum.shopware.com/u/Moritz_Naczenski)\
**Post date:** [12. März 2020 um 07:47 UTC](https://forum.shopware.com/t/why-shopware-6-is-caching-the-events/65445/4 "2020-03-12T07:47:27Z")

</div>

Do you have any criterias that are based on the logged in customer and so on? Something that will change between requests?  
Because it should work with general criterias (e.g. „only products with stock \> 500“), because the output will always be the same.&nbsp;

---

<div class="post-metadata">

**Author:** ![abinjohnedamana](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/abinjohnedamana/32/17378_2.png) [@abinjohnedamana](https://forum.shopware.com/u/abinjohnedamana)\
**Post date:** [12. März 2020 um 09:17 UTC](https://forum.shopware.com/t/why-shopware-6-is-caching-the-events/65445/5 "2020-03-12T09:17:10Z")

</div>

> [@Moritz Naczenski schrieb:](https://forum.shopware.com/profile/14574/Moritz%20Naczenski "Moritz%20Naczenski")
> 
> Do you have any criterias that are based on the logged in customer and so on? Something that will change between requests?  
> Because it should work with general criterias (e.g. „only products with stock \> 500“), because the output will always be the same. I
> 
> &nbsp;
> 
> I have added two custom fields for products, published from date and published to date. so i want to show the products only if the current date is in between these 2 dates.
> 
> This checking must be done in category wise product listing,product search result.

---

<div class="post-metadata">

**Author:** ![COMASO-IT](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/comaso-it/32/19439_2.png) [@COMASO-IT](https://forum.shopware.com/u/COMASO-IT)\
**Post date:** [28. Januar 2024 um 18:37 UTC](https://forum.shopware.com/t/why-shopware-6-is-caching-the-events/65445/6 "2024-01-28T18:37:59Z")

</div>

Hi @abinjohnedamana,  
this might come a little late, but have you been able to resolve your issue with adding criteria using the ProductSearchCriteriaEvent?

I face a quite similar issue with ProductListingCriteriaEvent.

---

<div class="post-metadata">

**Author:** ![shopwarer1638](https://avatars.discourse-cdn.com/v4/letter/s/76d3ee/32.png) [@shopwarer1638](https://forum.shopware.com/u/shopwarer1638)\
**Post date:** [24. September 2024 um 08:17 UTC](https://forum.shopware.com/t/why-shopware-6-is-caching-the-events/65445/7 "2024-09-24T08:17:15Z")

</div>

Have you found the solution? A filter plugin doesn’t work after update to 6.5.7.0.
