0
<script type="text/javascript">     jQuery(document).ready(function(){ jQuery('#shopping-cart-table')
    .on(
        'change',
        'input[name$="[qty]"]',
        function(){
            var form = jQuery(jQuery(this).closest('form'));    

            jQuery.ajax({
                url: form.attr('action'),
                method: form.attr('method'),
                data: form.serializeArray()
            });
        }
    ); });  </script>

I used this function for the Ajax update cart, ajax request is working but it is not updating in the cart, anybody done this ajax update cart please help me.

2

1 Answer 1

3

Assume that your form action url is checkout/cart/updatePost/ and have no customization at Mage_Checkout_CartController at updatePostAction().

Then you need to understand that the request to checkout/cart/updatePost does not render the cart page content. So if you tried to get the cart page content from the response, it's a waste of time. The response is a 302 redirect after the cart was updated.

So you need to use a customized cart controller.

Also make sure, that the form_key input field is present.

1
  • How to update quantity ajax through in mangeto1.9
    – Rv Singh
    Commented Oct 24, 2019 at 10:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.