Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at

  • Travis Schoening 47 posts 172 karma points
    Oct 18, 2017 @ 05:51
    Travis Schoening

    Update Cart/Basket through ajax when adding an item

    I'd like to have a shopping cart/basket integrated into my navigation (the actual cart, not just the number of items).

    I can get the cart to display fine, but if I'm on a product page and add to cart, I'd like to have the cart updated automatically (currently it will only update on a refresh or navigating to a different page).

    Along the same lines, I'd love to remove an item by clicking on the remove button without a direct post action to the browser.

    Does anyone have an idea on how to implement this type of behavior (if it is possible)?


  • Tolu Jemilua 39 posts 166 karma points
    Oct 19, 2017 @ 09:12
    Tolu Jemilua

    You could have a controller action called DisplayCart, which gets the cart after adding it

    something like: Clicks on add to cart Ajax adds to cart => using a callback => Ajax getCart

    that way you get a refreshed cart

    Same applies to remove from cart

Please Sign in or register to post replies

Write your reply to: