From 45c1b678860d45d122311bca253ddbcc1e813696 Mon Sep 17 00:00:00 2001 From: DuvCharles Date: Tue, 21 Nov 2023 18:21:51 +0100 Subject: [PATCH] :sparkles: display shipping amount --- components/cart/modal.tsx | 6 +++++- lib/sylius/normalizer/cart-normalizer.ts | 3 ++- lib/sylius/types.ts | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/components/cart/modal.tsx b/components/cart/modal.tsx index fa1c54d73d..6817894ba4 100644 --- a/components/cart/modal.tsx +++ b/components/cart/modal.tsx @@ -163,7 +163,11 @@ export default function CartModal({ cart }: { cart: Cart | undefined }) {

Shipping

-

Calculated at checkout

+

Total

diff --git a/lib/sylius/normalizer/cart-normalizer.ts b/lib/sylius/normalizer/cart-normalizer.ts index fa7568cd83..30c58e97a7 100644 --- a/lib/sylius/normalizer/cart-normalizer.ts +++ b/lib/sylius/normalizer/cart-normalizer.ts @@ -11,7 +11,8 @@ export const normalizeCart = (syliusCart: SyliusCart): Cart => { cost: { subtotalAmount: normalizePrice(syliusCart.itemsTotal), totalAmount: normalizePrice(syliusCart.total), - totalTaxAmount: normalizePrice(syliusCart.taxTotal) + totalTaxAmount: normalizePrice(syliusCart.taxTotal), + shippingAmount: normalizePrice(syliusCart.shippingTotal) }, lines: syliusCart.items.map((item) => normalizeCartItem(item)), totalQuantity: syliusCart.items.reduce((acc, item) => acc + item.quantity, 0) diff --git a/lib/sylius/types.ts b/lib/sylius/types.ts index 616c05ad49..7691002293 100644 --- a/lib/sylius/types.ts +++ b/lib/sylius/types.ts @@ -5,6 +5,7 @@ export interface Cart { subtotalAmount: Money; totalAmount: Money; totalTaxAmount: Money; + shippingAmount: Money; }; lines: CartItem[]; totalQuantity: number;