NewGit
Sign in

Apply discounts before summing the cart !1

Open @demo wants to merge AGit mr-1 main opened
Versions
Ready to merge
Changes in v1 against the merge base with main
1 file changed+2−0
cart.go +2−0 View file
Changes to cart.go: 2 additions, 0 deletions
Old lineNew lineChangeCode
@@ -43,3 +43,5 @@ func showCart(w http.ResponseWriter, r *http.Request) {
4343}
4444
4545func validQuantity(q int) bool { return q > 0 && q <= 99 }
46added
47addedfunc discounted(p Product) float64 { return p.Price * (1 - p.Discount) }