cancel
Showing results for 
Search instead for 
Did you mean: 

Update Cart automatically Using Increment and decrement Button in cart page

Update Cart automatically Using Increment and decrement Button in cart page

I have included + and - to increment and decrement the quantity of a product in the cart page. Now i need to update it automatically without clicking the update shopping cart button. How can i do that? Kindly help me to fix this problem

10 REPLIES 10

Re: Update Cart automatically Using Increment and decrement Button in cart page

Hello @anand_v

 

You can follow below URL for your reference:

 

https://magento.stackexchange.com/questions/216496/adding-quantity-increment-button-in-cart-and-mini...

https://webkul.com/blog/update-item-quantity-minicart-magento2/

 

 

Let me know if you still face any issue.

 

Kudos and accept it as a solution if it works. Cheers coding Smiley Happy

Manish Mittal
https://www.manishmittal.com/

Re: Update Cart automatically Using Increment and decrement Button in cart page

Thanks @Manish Mittal for your response.

I had tried using the first link (stackexchange.com). It increments and decrements the quantity. But i need to update the cart automatically once i clicks the +/- button. If i clicks the +/- button, the page has to be load and the cart value needs to be changed. I am stuck on that updation. Kindly help if you know the solution for that.

Re: Update Cart automatically Using Increment and decrement Button in cart page

Re: Update Cart automatically Using Increment and decrement Button in cart page

Hi @Manish Mittal 

Refused to execute script from 'http://127.0.0.1/magento/pub/static/frontend/Samplestore/theme/en_US/custom.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
require.js:141 Uncaught Error: Script error for: custom
http://requirejs.org/docs/errors.html#scripterror
at makeError (require.js:166)
at HTMLScriptElement.onScriptError (require.js:1681)

I have got these errors in the console.

Re: Update Cart automatically Using Increment and decrement Button in cart page

Can you please share the details of Network tab (Chrome debug toolbar) as well?

It seems request should return content in some format (like JSON) & its returning in another format (Might be due to 404 status OR something else).

 

 

 

 

Re: Update Cart automatically Using Increment and decrement Button in cart page

  Hi @ashishhbti. Please find below the screenshot.Screen Shot 2018-09-12 at 5.09.23 PM.png

Re: Update Cart automatically Using Increment and decrement Button in cart page

@anand_v

 

It seems that you have placed your js file on the wrong location.

Currently, your js file location is

 

http://127.0.0.1/magento/app/design/frontend/Samplestore/theme/custom.js

 

But it must be as given below

 

http://127.0.0.1/magento/app/design/frontend/Samplestore/theme/web/js/custom.js

 

If you find my answer useful, Please click Kudos & Accept as Solution.

Re: Update Cart automatically Using Increment and decrement Button in cart page

Hi @Mayur Bhuva

No i have placed in the correct location. 

i.e., in the 

http://127.0.0.1/magento/app/design/frontend/Samplestore/theme/web/js/custom.js

 

Re: Update Cart automatically Using Increment and decrement Button in cart page

@anand_v

 

Please update your code here so It will be very useful for everyone to answer.

If you find my answer useful, Please click Kudos & Accept as Solution.