I want to update the mini cart on button click.

If the product is not exist in the cart, it should add the product in the cart.

If product already added, it should update the quantity (increase or decrease) of product in the cart.

How can I achieve this?

Currently, quantity is only increasing if the product is already added in the cart.

Edit: if product exist i am changing form action to following url:

<?php echo Mage::getBaseUrl(); ?>checkout/cart/updateItemOptions/id/<?php echo $_product->getId(); ?>
  • How do you show product in mini cart if it's not added or does not exist in cart? Please add your code which you have tried so far.
    – Neha Raval
    Mar 8, 2017 at 15:42
  • @NehaRaval I have edited the question.
    – prashanth
    Mar 8, 2017 at 16:53
  • 1
    @prashanth Either remove the product from the cart and again add the product in the cart with updated quantity or update the product quantity against quote id. Mar 9, 2017 at 7:45


Your Answer

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