Hide currency conversion after checkout (#343)

This commit is contained in:
Megan O'Keefe 2020-05-06 09:22:02 -04:00 committed by GitHub
parent dbde2f3bff
commit 05758f56b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -88,6 +88,7 @@ func (fe *frontendServer) homeHandler(w http.ResponseWriter, r *http.Request) {
"session_id": sessionID(r),
"request_id": r.Context().Value(ctxKeyRequestID{}),
"user_currency": currentCurrency(r),
"show_currency": true,
"currencies": currencies,
"products": ps,
"cart_size": cartSize(cart),
@ -165,6 +166,7 @@ func (fe *frontendServer) productHandler(w http.ResponseWriter, r *http.Request)
"request_id": r.Context().Value(ctxKeyRequestID{}),
"ad": fe.chooseAd(r.Context(), p.Categories, log),
"user_currency": currentCurrency(r),
"show_currency": true,
"currencies": currencies,
"product": product,
"recommendations": recommendations,
@ -266,8 +268,6 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request
}
totalPrice = money.Must(money.Sum(totalPrice, *shippingCost))
log.Info("🌈 ITEMS: %v", items)
year := time.Now().Year()
if err := templates.ExecuteTemplate(w, "cart", map[string]interface{}{
"session_id": sessionID(r),
@ -277,6 +277,7 @@ func (fe *frontendServer) viewCartHandler(w http.ResponseWriter, r *http.Request
"recommendations": recommendations,
"cart_size": cartSize(cart),
"shipping_cost": shippingCost,
"show_currency": true,
"total_cost": totalPrice,
"items": items,
"expiration_years": []int{year, year + 1, year + 2, year + 3, year + 4},
@ -345,6 +346,7 @@ func (fe *frontendServer) placeOrderHandler(w http.ResponseWriter, r *http.Reque
"session_id": sessionID(r),
"request_id": r.Context().Value(ctxKeyRequestID{}),
"user_currency": currentCurrency(r),
"show_currency": false,
"currencies": currencies,
"order": order.GetOrder(),
"total_paid": &totalPaid,

View File

@ -21,6 +21,9 @@
<div class="navbar">
<div class="container d-flex justify-content-between">
<div class="h-free-shipping">Free shipping with $75 purchase! &nbsp;&nbsp;</div>
{{ if $.show_currency }}
<div class="h-controls">
<div class="h-control">
<img src="/static/icons/Hipster_CurrencyIcon.svg" alt="icon" class="icon" />
@ -34,6 +37,8 @@
<img src="/static/icons/Hipster_DownArrow.svg" alt="icon" class="icon arrow" />
</div>
</div>
{{ end }}
</div>
</div>
<div class="navbar sub-navbar">
@ -53,5 +58,6 @@
</div>
</div>
</div>
</header>
{{end}}