# Shopware events or hooks for shop change

**URL:** <https://forum.shopware.com/t/shopware-events-or-hooks-for-shop-change/61001>\
**Category:** Plugins\
**Created:** [12. August 2019 um 05:58 UTC](https://forum.shopware.com/t/shopware-events-or-hooks-for-shop-change/61001 "2019-08-12T05:58:17Z")\
**Posts on this page:** 2\
**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. August 2019 um 05:58 UTC](https://forum.shopware.com/t/shopware-events-or-hooks-for-shop-change/61001/1 "2019-08-12T05:58:17Z")

</div>

Hi

Are there any events or hooks available to detect the shop change form frontend (shop change dropdown in the header.)?

How we can check the customer changed the shop in frond-end? (I what to do some function after the shop change in my plugin).

---

<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:** [19. September 2019 um 11:02 UTC](https://forum.shopware.com/t/shopware-events-or-hooks-for-shop-change/61001/2 "2019-09-19T11:02:57Z")

</div>

-------- My solution is ---------------

&nbsp; &nbsp;public static function getSubscribedEvents()  
&nbsp; &nbsp; {  
&nbsp; &nbsp; &nbsp; &nbsp; return [  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Shop change  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ‘Enlight\_Controller\_Front\_RouteShutdown’ =\> ‘checkShopUpgrade’,  
&nbsp; &nbsp; &nbsp; &nbsp; ];  
&nbsp; &nbsp; }

&nbsp; &nbsp;/\*\*  
&nbsp; &nbsp; &nbsp;\* Event listener method  
&nbsp; &nbsp; &nbsp;\*/  
&nbsp; &nbsp; public function checkShopUpgrade(\Enlight\_Controller\_EventArgs $args)  
&nbsp; &nbsp; {  
&nbsp; &nbsp; &nbsp; &nbsp; $request = $args-\>getRequest();  
&nbsp; &nbsp; &nbsp; &nbsp; $response = $args-\>getResponse();

&nbsp; &nbsp; &nbsp; &nbsp; if (Shopware()-\>Container()-\>initialized(‘shop’)) {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if($request-\>getPost(’\_\_shop’) !== null && $request-\>getPost(’\_\_redirect’) !== null)  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //Shop changed  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-\>updateAbandonedCartItemsOnShopChange();

&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return true;  
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }  
&nbsp; &nbsp; &nbsp; &nbsp; }

&nbsp; &nbsp; &nbsp; &nbsp; return false;  
&nbsp; &nbsp; }
