@@ -3,6 +3,7 @@ import { getFormatter, getTranslations } from 'next-intl/server';
3
3
4
4
import { Cart as CartComponent , CartEmptyState } from '@/vibes/soul/sections/cart' ;
5
5
import { getCartId } from '~/lib/cart' ;
6
+ import { exists } from '~/lib/utils' ;
6
7
7
8
import { redirectToCheckout } from './_actions/redirect-to-checkout' ;
8
9
import { updateLineItem } from './_actions/update-line-item' ;
@@ -89,7 +90,32 @@ export default async function Cart() {
89
90
return (
90
91
< >
91
92
< CartComponent
93
+ cart = { {
94
+ lineItems : formattedLineItems ,
95
+ total : format . number ( checkout ?. grandTotal ?. value || 0 , {
96
+ style : 'currency' ,
97
+ currency : cart . currencyCode ,
98
+ } ) ,
99
+ totalLabel : t ( 'CheckoutSummary.grandTotal' ) ,
100
+ summaryItems : [
101
+ {
102
+ label : t ( 'CheckoutSummary.subTotal' ) ,
103
+ value : format . number ( checkout ?. subtotal ?. value ?? 0 , {
104
+ style : 'currency' ,
105
+ currency : cart . currencyCode ,
106
+ } ) ,
107
+ } ,
108
+ checkout ?. taxTotal && {
109
+ label : 'Tax' ,
110
+ value : format . number ( checkout . taxTotal . value , {
111
+ style : 'currency' ,
112
+ currency : cart . currencyCode ,
113
+ } ) ,
114
+ } ,
115
+ ] . filter ( exists ) ,
116
+ } }
92
117
checkoutAction = { redirectToCheckout }
118
+ checkoutLabel = { t ( 'proceedToCheckout' ) }
93
119
decrementLineItemLabel = { t ( 'decrement' ) }
94
120
deleteLineItemLabel = { t ( 'removeItem' ) }
95
121
emptyState = { {
@@ -100,28 +126,7 @@ export default async function Cart() {
100
126
incrementLineItemLabel = { t ( 'increment' ) }
101
127
key = { `${ cart . entityId } -${ cart . version } ` }
102
128
lineItemAction = { updateLineItem }
103
- lineItems = { formattedLineItems }
104
- summary = { {
105
- title : t ( 'CheckoutSummary.title' ) ,
106
- taxLabel : t ( 'CheckoutSummary.tax' ) ,
107
- tax : checkout ?. taxTotal
108
- ? format . number ( checkout . taxTotal . value , {
109
- style : 'currency' ,
110
- currency : cart . currencyCode ,
111
- } )
112
- : '' ,
113
- subtotalLabel : t ( 'CheckoutSummary.subTotal' ) ,
114
- subtotal : format . number ( checkout ?. subtotal ?. value ?? 0 , {
115
- style : 'currency' ,
116
- currency : cart . currencyCode ,
117
- } ) ,
118
- grandTotalLabel : t ( 'CheckoutSummary.grandTotal' ) ,
119
- grandTotal : format . number ( checkout ?. grandTotal ?. value || 0 , {
120
- style : 'currency' ,
121
- currency : cart . currencyCode ,
122
- } ) ,
123
- ctaLabel : t ( 'proceedToCheckout' ) ,
124
- } }
129
+ summaryTitle = { t ( 'CheckoutSummary.title' ) }
125
130
title = { t ( 'title' ) }
126
131
/>
127
132
< CartViewed
0 commit comments