[Skip to main content](#vessel-content)

#   Clear cart on language change, possible?

##

- **[dyvel](/forum/user/39996-dyvel "View dyvel's Profile")**
- [![dyvel's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/39996-dyvel "View dyvel's Profile") Topic Author
- [ Offline](/forum/user/39996-dyvel)

Less More

- Posts: 88
- Thank you received: 20
-
-

9 years 8 months ago [\#264564](#264564) by [dyvel](/forum/user/39996-dyvel "View dyvel's Profile")  *[Clear cart on language change, possible?](/forum/31-development/889279-clear-cart-on-language-change-possible#264564 "Hi  Would it be possible to create a function that clears the cart, if the user changes language?  Thanks :-)")* was created by *[dyvel](/forum/user/39996-dyvel "View dyvel's Profile")*

Hi

Would it be possible to create a function that clears the cart, if the user changes language?

Thanks ![:-)](/media/kunena/emoticons/3.png ":-)")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTI3OS1jbGVhci1jYXJ0LW9uLWxhbmd1YWdlLWNoYW5nZS1wb3NzaWJsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[dyvel](/forum/user/39996-dyvel "View dyvel's Profile")**
- [![dyvel's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/39996-dyvel "View dyvel's Profile") Topic Author
- [ Offline](/forum/user/39996-dyvel)

Less More

- Posts: 88
- Thank you received: 20
-
-

9 years 8 months ago [\#264587](#264587) by [dyvel](/forum/user/39996-dyvel "View dyvel's Profile")  Replied by *[dyvel](/forum/user/39996-dyvel "View dyvel's Profile")* on topic *[Clear cart on language change, possible?](/forum/31-development/889279-clear-cart-on-language-change-possible#264587 "Hi  Would it be possible to create a function that clears the cart, if the user changes language?  Thanks :-)")*

I've created this function to delete the cart - may be there's a better solution, but it works
Code:

if ($_SESSION['CartLang'] != $_COOKIE[JApplication::getHash('language')]) : $_SESSION['CartLang'] = JFactory::getLanguage()-&gt;getTag(); $session_id = JFactory::getSession()-&gt;getId(); $db = JFactory::getDbo(); $query = "DELETE FROM #__hikashop_cart WHERE session_id='$session_id'"; $db-&gt;setQuery($query); $result = $db-&gt;execute(); endif;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTI3OS1jbGVhci1jYXJ0LW9uLWxhbmd1YWdlLWNoYW5nZS1wb3NzaWJsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26400
- Thank you received: 4079
-
- [](http://obsi.dev)
-

9 years 8 months ago [\#264566](#264566) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Clear cart on language change, possible?](/forum/31-development/889279-clear-cart-on-language-change-possible#264566 "Hi  Would it be possible to create a function that clears the cart, if the user changes language?  Thanks :-)")*

Hi,

If you find the right trigger in Joomla to be notified when the language is changing ; for sure you can then include the HikaShop helper and call the HikaShop cart class to clean the cart.
[ www.hikashop.com/support/documentation/6...r-documentation.html](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html)

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50Lzg4OTI3OS1jbGVhci1jYXJ0LW9uLWxhbmd1YWdlLWNoYW5nZS1wb3NzaWJsZT90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.046 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
