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

#   Replacing previous item in cart with new one.

##

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

Less More

- Posts: 2
- Thank you received: 0
-
-

12 years 1 month ago [\#176745](#176745) by [Phoblution](/forum/user/34702-phoblution "View Phoblution's Profile")  *[Replacing previous item in cart with new one.](/forum/27-checkout/872547-replacing-previous-item-in-cart-with-new-one#176745 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.32 -- Browser(s) name and version -- : Chrome  I limited the number of items in the cart to 1, but it's not quite what I wanted. is there a way to replace the previous item with the new one every time you click &quot;add to cart&quot; on another item?  If not, is there a way to automatically clear out the cart when you leave the checkout and go back to exploring the site?")* was created by *[Phoblution](/forum/user/34702-phoblution "View Phoblution's Profile")*

-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.4.32
-- Browser(s) name and version -- : Chrome

I limited the number of items in the cart to 1, but it's not quite what I wanted. is there a way to replace the previous item with the new one every time you click "add to cart" on another item?

If not, is there a way to automatically clear out the cart when you leave the checkout and go back to exploring the site?

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

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

12 years 1 month ago [\#176748](#176748) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Replacing previous item in cart with new one.](/forum/27-checkout/872547-replacing-previous-item-in-cart-with-new-one#176748 "-- HikaShop version -- : 2.3.4 -- Joomla version -- : 3.3.6 -- PHP version -- : 5.4.32 -- Browser(s) name and version -- : Chrome  I limited the number of items in the cart to 1, but it's not quite what I wanted. is there a way to replace the previous item with the new one every time you click &quot;add to cart&quot; on another item?  If not, is there a way to automatically clear out the cart when you leave the checkout and go back to exploring the site?")*

Hi,

The easiest way will be to make a little plugin based on the function "onBeforeCartUpdate()" in order to reset the cart before adding a new product.
This way it will replace the item in cart with the new one.

Here is some documentation:
[ hikashop.com/support/support/documentati...r-documentation.html](https://hikashop.com/support/support/documentation/62-hikashop-developer-documentation.html)

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3MjU0Ny1yZXBsYWNpbmctcHJldmlvdXMtaXRlbS1pbi1jYXJ0LXdpdGgtbmV3LW9uZT90bXBsPW1hcmtkb3du) 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.051 seconds

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