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

#   Cart does not get empty after order creation?

##

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

Less More

- Posts: 64
- Thank you received: 0
-
-

13 years 1 month ago [\#129798](#129798) by [irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")  *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#129798 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")* was created by *[irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")*

I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?

Thanks,

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

13 years 1 month ago [\#129811](#129811) 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 *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#129811 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

Hi,

Can you give us more information about the issue that you're having, through some screenshots for example ? Note that It's maybe a cache issue, thansk to try to disable the Joomla cache, and clear it. You'll also have to disable it in the joomla config, and unpublish the cache plugin.

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

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

Less More

- Posts: 64
- Thank you received: 0
-
-

13 years 4 weeks ago [\#130098](#130098) by [irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")  Replied by *[irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#130098 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

The problem is once order is created all cart products should be removed.I have attached two snapshot.
Please have a look and let me know if not clear.

Thanks,

- [ ![h9821211.png](/forum/attachment/13282) ](/forum/attachment/13282 "h9821211.png") [ ](/forum/attachment/13282?download=1 "h9821211.png")
- [ ![hedb299b.png](/forum/attachment/13283) ](/forum/attachment/13283 "hedb299b.png") [ ](/forum/attachment/13283?download=1 "hedb299b.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzE3My1jYXJ0LWRvZXMtbm90LWdldC1lbXB0eS1hZnRlci1vcmRlci1jcmVhdGlvbj90bXBsPW1hcmtkb3du) 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: 86587
- Thank you received: 14326
-
-

13 years 4 weeks ago [\#130281](#130281) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#130281 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

Please make sure that you configured the option "Clean cart when order is" of the configuration to "created".

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

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

Less More

- Posts: 64
- Thank you received: 0
-
-

13 years 4 weeks ago [\#130285](#130285) by [irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")  Replied by *[irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#130285 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

Yes,setting is exactly what you said.It works fine for other case but if product is added through entry fields then there is a problem.

Thanks,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzE3My1jYXJ0LWRvZXMtbm90LWdldC1lbXB0eS1hZnRlci1vcmRlci1jcmVhdGlvbj90bXBsPW1hcmtkb3du) 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: 26402
- Thank you received: 4081
-
- [](http://obsi.dev)
-

13 years 4 weeks ago [\#130458](#130458) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#130458 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

Hi,

I created a ticket in our bug tracker.

Regards,

---

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

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

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

Less More

- Posts: 64
- Thank you received: 0
-
-

13 years 2 weeks ago [\#132322](#132322) by [irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")  Replied by *[irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#132322 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

Is there any solution that I can apply?

Thanks,

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

13 years 2 weeks ago [\#132377](#132377) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#132377 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

Hi,

As temporary fix, you can probably create a plugin based on the function: onAfterOrderCreate(&amp;$order,&amp;$send_email)
And in this function use the code: Code:

$cartClass = hikashop_get('class.cart'); $cartClass-&gt;resetCart();

This will force the reset of the cart when entering the order create function.

Here is some documentation about plugins:
[ www.hikashop.com/support/documentation/6...mentation.html#order](http://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#order)

The following user(s) said Thank You: [irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")

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

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

Less More

- Posts: 64
- Thank you received: 0
-
-

12 years 11 months ago [\#137742](#137742) by [irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")  Replied by *[irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#137742 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

It was seem to be working fine.But I noticed that it does not save entries if we reset the cart after order create.Could you please help me to solve this?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzE3My1jYXJ0LWRvZXMtbm90LWdldC1lbXB0eS1hZnRlci1vcmRlci1jcmVhdGlvbj90bXBsPW1hcmtkb3du) 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 10 months ago [\#138690](#138690) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#138690 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

Hi,

Thanks to explain with more details what you mean by "it does not save entries" ?

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

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

Less More

- Posts: 64
- Thank you received: 0
-
-

12 years 10 months ago [\#138717](#138717) by [irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")  Replied by *[irfanhanfi](/forum/user/23811-irfanhanfi "View irfanhanfi's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#138717 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

For example if I have two fields in Entry form Name and Product Dropdown.It adds product as per drop down selection but does not save entries in Entry table(#__hikashop_entry).The reason is Entry inserted into table after onAfterOrderCreate Event.Is there any other way to empty cart?

I hope this is clear.

Thanks,

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg2MzE3My1jYXJ0LWRvZXMtbm90LWdldC1lbXB0eS1hZnRlci1vcmRlci1jcmVhdGlvbj90bXBsPW1hcmtkb3du) 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 10 months ago [\#139198](#139198) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Cart does not get empty after order creation?](/forum/27-checkout/863173-cart-does-not-get-empty-after-order-creation#139198 "I am using Entry fields form.And after order creation cart does not get empty.I have got the same issue in demo site.Is this intentional or how can I change this?  Thanks,")*

Another way to clean the cart could be to jsut create a new cart for the current user.
Like it's done in the "newcart()" function in the frontend cart controller.

The content of the function is: Code:

$app = JFactory::getApplication(); $cartClass = hikashop_get('class.cart'); $cart_type = JRequest::getString('cart_type','cart'); // set all the user carts cart_current to 0 in DB $result = $cartClass-&gt;setCurrent('0',$cart_type); // Create a new cart $session = JFactory::getSession(); $curUser = hikashop_loadUser(true); $newCart = new stdClass(); if($curUser == null) $newCart-&gt;user_id = 0; else $newCart-&gt;user_id = $curUser-&gt;user_cms_id; $newCart-&gt;session_id = $session-&gt;getId(); $newCart-&gt;cart_modified = time(); $newCart-&gt;cart_type = $cart_type; $newCart-&gt;cart_current = 1; $newCart-&gt;cart_share = 'nobody'; $cartClass-&gt;save($newCart); // EO Create a new cart // set the current cart to 0 in session. $app-&gt;setUserState(HIKASHOP_COMPONENT.'.'.$cart_type.'_id', '0'); // set the "new_cart" parameter in session $app-&gt;setUserState(HIKASHOP_COMPONENT.'.'.$cart_type.'_new', '1');

You need to adapt it for the plugin.

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

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