def cart_add(): product_id = request.args.get("product_id", type=int) product = Product.first(id=product_id) if not product: return "" Cart.add(product) return render_update( "cart/add.html", counter=Cart.count(), )
def cart_remove(): product_id = request.args.get("product_id", type=int) product = Product.first(id=product_id) if not product: return "" Cart.remove(product) return render_update( "cart/remove.html", counter=Cart.count(), cart_items=Cart.get_all(), )