Copied to clipboard

Flag this post as spam?

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


  • Gordon Saxby 1243 posts 1450 karma points
    15 days ago
    Gordon Saxby
    0

    Basket does not clear when deleting last item

    I have checked this on the demo site - https://demo.teacommerce.net/ - and the same thing happens as on our site.

    Clear cookies to ensure no order referenced. Add any item to the basket. Go to basket and remove item - either by clicking minus sign or "x" delete. Item is removed.

    That functionality is fine, but basket still shows sub-total / total rows and more importantly, still has the Continue button which is active. Clicking it takes you to the next page ... and you can continue all the way through the order process.

    How can I make TeaCommerce realise that the basket is empty when all products have been removed?

  • Matt Brailsford 2053 posts 10078 karma points MVP 5x c-trib
    14 days ago
    Matt Brailsford
    100

    Hi Gordon,

    I think the simplest thing would be on your checkout pages to instead of just null checking order, also check to see if you actually have any order lines.

    if (order != null && order.OrderLines.Count > 0) {
        // Show the checkout page
    }
    

    If you want to remove the order if there are no order lines, then you could create an event handler and listen for either the order Updated or OrderLinesRemoved events and if the order has no order lines left then call order.Delete().

Please Sign in or register to post replies

Write your reply to:

Draft