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

#   Disable cart or cart memory

##

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago [\#191516](#191516) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#191516 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")* was created by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")*

-- HikaShop version -- : 2.3.5

Hello,

I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product.
I have hidden cart and after adding item to cart customer is redirected to checkout.

But when customer quit his checkout and buy item again he have to pay for both two items.

I need to disable cart, or its memory in order to pay just for one item (last added to cart).

Thank you
Filip

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

11 years 8 months ago [\#191587](#191587) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#191587 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hi,

Click on the "limit" button of the products listing in your backend. There, create a new limit. In it, set the "period" to "cart", the "type" to "quantity" and the "value" to "1" and that will only allow one item in the cart.
When the user will try to add a second product in the cart, it will display an error message to the user.

That's the closest you can get to what you need without any coding.

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago [\#191592](#191592) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#191592 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Yes that is what I allready did. But I need to hide this error message and I need to delete old item in cart and add recent.

I hope you understand me.
Thank you in advance
F

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

11 years 8 months ago [\#191595](#191595) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#191595 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hi,

In that case, you should not use a limit and develop a HikaShop plugin implementing in it the onBeforeCartUpdate trigger where you would call $cartClass-&gt;resetCart in order to reset the cart whenever a user would add a product to the cart.

As I said in my previous message, the limit configuration is the closest to what you want without coding anything.

The following user(s) said Thank You: [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago -  11 years 8 months ago [\#191723](#191723) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#191723 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hello, I made plugin with following code but it does not work -absolutely nothing happens
I did plugin exacly by developers documentation.
Code:

function onBeforeCartUpdate(&amp;$cartClass,&amp;$cart,$product_id,$quantity,$add,$type,$resetCartWhenUpdate,$force,&amp;$do) { $cartClass = hikashop_get('class.cart'); $cartClass-&gt;resetCart(); $app = JFactory::getApplication(); $app-&gt;redirect( $this-&gt;redirect_url ); }

Thank you

Last edit: 11 years 8 months ago by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile").

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

- **[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")**
- [![Mohamed Thelji's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar6861.png)](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")
- [ Offline](/forum/user/6861-mohamed-thelji)

Less More

- Posts: 12953
- Thank you received: 1778
-
-
-

11 years 8 months ago [\#191743](#191743) by [Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")  Replied by *[Mohamed Thelji](/forum/user/6861-mohamed-thelji "View Mohamed Thelji's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#191743 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hello,
Are you sure that you have correctly published your plugin ? if yes, you should probably add some debug code on your plugin to see if it's really called.

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago [\#192004](#192004) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192004 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hello,

yes plugin is really published.
Could you send me example of debug?

Many thanks
FILIP

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

11 years 8 months ago [\#192005](#192005) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192005 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hi,

You should remove the line:
$cartClass = hikashop_get('class.cart');
as $cartClass is already given to you.

And you don't want the redirect either or the product wouldn't be added to the cart at all.

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago [\#192072](#192072) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192072 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hello,

Thank you very much I will try it as soon as I get home.

I need on current procedure to remove existing items to cart,
add new item and go to checkout.

Thank you

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago [\#192282](#192282) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192282 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hello,

I think the trigger isn't called or plugin isn't loaded.
Could you check it please? I am helpless ![:/](/irritated.gif ":/")

*This attachment is hidden for guests.
Please log in or register to see it.*

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

11 years 8 months ago [\#192305](#192305) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192305 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

I've installed the plugin on my end and added an exit after the echo "it works" code and I get the message:
[ take.ms/TcZxf](http://take.ms/TcZxf)
So the trigger is called just fine.
Note that if you turned on the "Use AJAX when possible for add to cart buttons" option of the HikaShop configuration, the add to cart will be done in ajax and thus you won't see your debug text and even without that, the message won't display on the page if you do a redirect just after that.

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago [\#192327](#192327) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192327 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hello Nicolas,

thank you.
I have display Use AJAX..... in hikashop configuration.
I don't know if I code the plugin correctly, its my first plugin.

I installed it in joomla extension manager, allowed it and after I checked that is allowed in hikashop plugins.

Have I forgotten something?

Thank you
Filip

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg3NTEzMy1kaXNhYmxlLWNhcnQtb3ItY2FydC1tZW1vcnk/dG1wbD1tYXJrZG93bg==) 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)
-

11 years 8 months ago [\#192328](#192328) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192328 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hi,

You have done all the needed steps to use the plugin.
As Nicolas said, to check if the plugin is called, you have to disable the AJax option in HikaShop and add an "exit;" after the "it works!" text to see the result.

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago -  11 years 8 months ago [\#192456](#192456) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192456 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hello, I don't know what I did but it almost works now.

But cart will be reseted and clicked item wasn't added. Even if the code is in onBeforeCartUpdate procedure.

Can somebody advise me method which **remove oldest product in cart?**

Thank you

Last edit: 11 years 8 months ago by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile").

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

11 years 8 months ago [\#192474](#192474) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192474 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

It's normal that the clicked item won't be added since you added a redirect in your onBeforeCartUpdate which will stop the cart update procedure before it had the time to add the new product into the cart.

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago [\#192498](#192498) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192498 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

I removed whole code except reseCart method but the problem is still there.
Is there any method which removes only 1 item from cart (first added)?

Thank you

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

11 years 8 months ago -  11 years 8 months ago [\#192539](#192539) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192539 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

It's not about removing one item. It's about reseting the cart before adding the new one.
I'm guessing that some other variables should be reset in the cartClass variable.

Maybe a simpler solution would be to do the add to cart yourself after the reset like that:
$cartClass = hikashop_get('class.cart');
$cartClass-&gt;resetCart();
$cartContent = $cartClass-&gt;get();
$cartClass-&gt;updateEntry($quantity,$cartContent,(int)$product_id,1,false,$type,$force);

Last edit: 11 years 8 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago [\#192568](#192568) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192568 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hello,

I place your code in onBeforeCartUpdate procedure but after clicking button "add to cart"
the blank page with this url was open (........product/updatecart)

Maybe some redirect to cart needed?

Thank you

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

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86564
- Thank you received: 14311
-
-

11 years 8 months ago [\#192577](#192577) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192577 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hi,

There was a typo in my code. I've edited my post to fix it. That should avoid the blank page.

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

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

Less More

- Posts: 217
- Thank you received: 4
-
-

11 years 8 months ago [\#192650](#192650) by [FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")  Replied by *[FilipHradil](/forum/user/36153-filiphradil "View FilipHradil's Profile")* on topic *[Disable cart or cart memory](/forum/27-checkout/875133-disable-cart-or-cart-memory#192650 "-- HikaShop version -- : 2.3.5  Hello,  I am starting eshop with wedding dresses. So I assume that customer won't buy more than 1 product. I have hidden cart and after adding item to cart customer is redirected to checkout.  But when customer quit his checkout and buy item again he have to pay for both two items.  I need to disable cart, or its memory in order to pay just for one item (last added to cart).  Thank you Filip")*

Hello,

thank you!!!
There was just little problem but if condition made it ![:)](/media/kunena/emoticons/3.png ":)")
Code:

if(!empty($cartContent)){ $cartClass = hikashop_get('class.cart'); $cartClass-&gt;resetCart(); $cartContent = $cartClass-&gt;get(); //$cartClass-&gt;updateEntry($quantity,$cartContent,(int)$product_id,1,false,$type,$force); }

Please, last little query, how can I logout user (just logout - without redirecting)

Thank you!

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

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