diff --git a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx index 5060dac41..74c2e09b7 100644 --- a/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx +++ b/components/checkout/CheckoutSidebarView/CheckoutSidebarView.tsx @@ -26,6 +26,12 @@ const CheckoutSidebarView: FC = () => { currencyCode: data.currency.code, } ) + const { price: taxes } = usePrice( + data && { + amount: Number(data.taxes), + currencyCode: data.currency.code, + } + ) return ( {
  • Taxes - Calculated at checkout + {data.taxes ? taxes : 'Calculated at checkout'}
  • Shipping diff --git a/framework/commerce/types/cart.ts b/framework/commerce/types/cart.ts index 9090fa502..97b120504 100644 --- a/framework/commerce/types/cart.ts +++ b/framework/commerce/types/cart.ts @@ -81,6 +81,8 @@ export type Cart = { totalPrice: number // Discounts that have been applied on the cart. discounts?: Discount[] + // The total for taxes + taxes?: number } /** diff --git a/framework/reactioncommerce/utils/normalize.ts b/framework/reactioncommerce/utils/normalize.ts index 8aec1717e..23a2e0446 100644 --- a/framework/reactioncommerce/utils/normalize.ts +++ b/framework/reactioncommerce/utils/normalize.ts @@ -203,8 +203,8 @@ export function normalizeProduct(productNode: CatalogItemProduct): Product { export function normalizeCart(cart: ReactionCart): Cart { return { id: cart._id, - customerId: '', - email: '', + customerId: cart.account?._id ?? '', + email: cart.account?.emailRecords[0].address ?? '', createdAt: cart.createdAt, currency: { code: cart.checkout?.summary?.total?.currency.code ?? '', @@ -218,6 +218,7 @@ export function normalizeCart(cart: ReactionCart): Cart { subtotalPrice: +(cart.checkout?.summary?.itemTotal?.amount ?? 0), totalPrice: cart.checkout?.summary?.total?.amount ?? 0, discounts: [], + taxes: cart.checkout?.summary?.taxTotal?.amount, } }