# Reload after change quantity function

**URL:** https://forum.shopware.com/t/reload-after-change-quantity-function/47074
**Category:** Plugins
**Created:** [23. Juli 2017 um 19:43 UTC](https://forum.shopware.com/t/reload-after-change-quantity-function/47074 "2017-07-23T19:43:16Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Maha](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Maha](https://forum.shopware.com/u/Maha)
#### Post date: [23. Juli 2017 um 19:43 UTC](https://forum.shopware.com/t/reload-after-change-quantity-function/47074/1 "2017-07-23T19:43:16Z")

</div>

Hi,

I would like to ask if someone can help me to find a solution for this problem…

how to avoid reload page after &nbsp;change the quantity of the product in Cart??

Thanks,

Maha

---

<div class="post-metadata">

### Author: ![Michael\_Telgmann](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/michael_telgmann/32/20289_2.png) [@Michael\_Telgmann](https://forum.shopware.com/u/Michael_Telgmann)
#### Post date: [24. Juli 2017 um 13:07 UTC](https://forum.shopware.com/t/reload-after-change-quantity-function/47074/2 "2017-07-24T13:07:14Z")

</div>

Hi Maha,

why do you want to avoid the reload? The quantity of a product was changed and so the state of the shopping cart. So it has to be recalculated. For that we have to reload the page.&nbsp;

Best regards from Schöppingen

![cool](http://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/shopware.png "cool")&nbsp;Michael Telgmann

---

<div class="post-metadata">

### Author: ![Maha](https://avatars.discourse-cdn.com/v4/letter/m/e495f1/32.png) [@Maha](https://forum.shopware.com/u/Maha)
#### Post date: [1. August 2017 um 15:08 UTC](https://forum.shopware.com/t/reload-after-change-quantity-function/47074/3 "2017-08-01T15:08:16Z")

</div>

Hi Micheal,

I want to move all the function of the cart to the&nbsp;&nbsp;Off-Canvas. should not mouve after changing the quantity ☹

Best Regards from Berlin.

---

<div class="post-metadata">

### Author: ![Stephan\_Pohl](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/stephan_pohl/32/10212_2.png) [@Stephan\_Pohl](https://forum.shopware.com/u/Stephan_Pohl)
#### Post date: [1. August 2017 um 15:28 UTC](https://forum.shopware.com/t/reload-after-change-quantity-function/47074/4 "2017-08-01T15:28:38Z")

</div>

Hey @maha,

I second&nbsp;[@Michael Telgmann]([http://forum.shopware.com/profile/17553/Michael](http://forum.shopware.com/profile/17553/Michael) Telgmann „Michael Telgmann“)‍ answer. The calculation of the basket is the main issue you’re facing. If you really wanna use an AJAX request to change the quantity you can implement it on your own.

We’re doing a similar thing for the variant change on the product detail page. Take a look on the following source code:&nbsp;[shopware/jquery.ajax-variant.js at 5.3 · shopware/shopware · GitHub](https://github.com/shopware/shopware/blob/5.3/themes/Frontend/Responsive/frontend/_public/src/js/jquery.ajax-variant.js)

I’ll break down what you have to do to reach your goal:

- Add an „submit“ event listener to the form which represents a row in the basket
- Read out the action and method attribute from the form and serialize the form itself. You need these information to create your AJAX request
- When you’re getting the data from the server, you have to find the information from the returned HTML document
- Next you have to find the elements containing the old information and replace them with the new information from the server response
- Up next you need to reinitialize the jQuery plugins which are used on the basket page

I hope this small list can help you out to understand what you have to do. Please keep in mind this is not a trivial task and takes quite a lot effort.

Best regards,  
Stephan Pohl&nbsp; ![Shopware](https://forum.shopware.com/plugins/CKEditor/plugins/smiley/images/shopware.png "Shopware")

---

<div class="post-metadata">

### Author: ![larryhems](https://avatars.discourse-cdn.com/v4/letter/l/7bcc69/32.png) [@larryhems](https://forum.shopware.com/u/larryhems)
#### Post date: [7. September 2020 um 06:14 UTC](https://forum.shopware.com/t/reload-after-change-quantity-function/47074/5 "2020-09-07T06:14:31Z")

</div>

> [@Michael Telgmann schrieb:](https://forum.shopware.com/profile/17553/Michael%20Telgmann "Michael%20Telgmann")
> 
> why do you wanft to avoid the reload?&nbsp;
> 
> &nbsp;

Noticed that location.reload() is slower than the other methods.

location.reload(forceGet)

forceGet:

- false - Default. Reloads the current page from the cache.
- true - The current page must be reloaded from the server.

From the Mozilla Developement Network I guess the .[reload](http://net-informations.com/jq/events/refresh.htm) method may fetch all files from the Server again. This would be similar to a CTRL + F5 reload.

The location.href for example, simply follows the link which may be cached. As for the MDN definition the behave is not clearly defined so I guess its browser and case specific behave.

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![Stephan1](https://avatars.discourse-cdn.com/v4/letter/s/cdc98d/32.png) [@Stephan1](https://forum.shopware.com/u/Stephan1)
#### Post date: [2. Oktober 2020 um 13:01 UTC](https://forum.shopware.com/t/reload-after-change-quantity-function/47074/6 "2020-10-02T13:01:47Z")

</div>

Hello…

How can i run a function after cart updates?

Regards ThopTV
