diff --git a/front/src/pages/Checkout.svelte b/front/src/pages/Checkout.svelte index 0ac5a7a..175113e 100644 --- a/front/src/pages/Checkout.svelte +++ b/front/src/pages/Checkout.svelte @@ -33,7 +33,8 @@ let unavailableItems: boolean; Cart.subscribe(() => { items = Cart.getEntries(); - totalPrice = Cart.getTotalPrice(); + totalPrice = 1.50 + Cart.getTotalPrice(); + if (CheckoutData.delivery) totalPrice += 3.00 unavailableItems = Cart.getEntries().some(([_, item]) => item.data.availability === false); }); @@ -49,9 +50,14 @@ ).addTo(leafletMap); L.marker([50.82304922105467, -0.432780150496344]).addTo(leafletMap); }); + + $: if (CheckoutData.delivery) { + totalPrice = 1.50 + 3.00 + Cart.getTotalPrice(); + } $: if (!CheckoutData.delivery) { // Rendering maybe off-centered since map was initialized when div was hidden setTimeout(() => { leafletMap.invalidateSize() }, 1); + totalPrice = 1.50 + Cart.getTotalPrice(); } function onSubmit() { @@ -233,6 +239,18 @@