def add_pet_to_cart(pet_id): cart = get_cart() pet = find_pet(pet_id) if pet is not None: cart['pets'].append(pet) save_cart(cart) return redirect(url_for('show_cart'))
def cart_add(pet_id): cart = get_cart() pet = find_pet(pet_id) cart.append(pet) new_cart = {'pets_in_cart': cart} save_cart(new_cart) return redirect(url_for('cart'))
def add_to_cart(id): pet = find_pet(id) cart = get_cart() if pet is not None: cart.append(pet) save_cart(cart) return redirect(url_for("show_cart"))
def add_pet(pet_id): pet = find_pet(pet_id) cart = get_cart() cart.append(pet) new_cart = {"pets_in_cart": cart} save_cart(new_cart) return redirect(url_for('cart'))
def empty_cart(): cart = {"pets": []} save_cart(cart) return redirect(url_for('index'))
def empty_cart(): cart = get_cart() cart.clear() new_cart = {'pets_in_cart': cart} save_cart(new_cart) return redirect(url_for('cart'))
def empty_cart(): cart = save_cart([]) total = get_cart_total(cart) return redirect(url_for("cart.html", cart=cart, total=total))