Post by michaelsen » Wed Feb 05, 2025 10:51 pm

When updating the quantity of a product in the shopping cart on OpenCart 4.1.0.0, instead of refreshing the cart page or updating it via AJAX, I am redirected to a plain-text JSON response page like this: /index.php?route=checkout/cart.edit&language=en-gb
Response: {"success":"Success: You have modified your shopping cart!"}
Normally, the cart should update dynamically without redirecting to a raw JSON response page.

This is on OC4.1.0.0 without any modifications or extensions installed, and the original theme.

Is this a known bug in OpenCart 4.1.0.0, or is something missing in the default JavaScript setup?
What’s the proper fix to ensure the cart updates dynamically instead of redirecting to a JSON response?

Any help would be greatly appreciated! Thanks in advance. 😊
Last edited by michaelsen on Thu Feb 06, 2025 4:03 am, edited 2 times in total.

New member

Posts

Joined
Tue May 03, 2011 3:17 am

Post by michaelsen » Thu Feb 06, 2025 4:02 am

Found the fix in the repository.

Change upload/catalog/view/template/checkout/cart.twig:
$('#shopping-cart').on('submit', '#cart form', function(e) {
to
$('#shopping-cart').on('submit', '#output-cart form', function(e) {

New member

Posts

Joined
Tue May 03, 2011 3:17 am
Who is online

Users browsing this forum: No registered users and 3 guests