File tree Expand file tree Collapse file tree
core/app/[locale]/(default)/cart Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,10 @@ export const PhysicalItemFragment = graphql(`
2828 currencyCode
2929 value
3030 }
31+ discountedAmount {
32+ currencyCode
33+ value
34+ }
3135 selectedOptions {
3236 __typename
3337 entityId
@@ -87,6 +91,10 @@ export const DigitalItemFragment = graphql(`
8791 currencyCode
8892 value
8993 }
94+ discountedAmount {
95+ currencyCode
96+ value
97+ }
9098 selectedOptions {
9199 __typename
92100 entityId
Original file line number Diff line number Diff line change @@ -213,6 +213,13 @@ export default async function Cart({ params }: Props) {
213213 const totalCouponDiscount =
214214 checkout ?. coupons . reduce ( ( sum , coupon ) => sum + coupon . discountedAmount . value , 0 ) ?? 0 ;
215215
216+ const totalLineItemDiscount = [
217+ ...cart . lineItems . physicalItems ,
218+ ...cart . lineItems . digitalItems ,
219+ ] . reduce ( ( sum , item ) => sum + item . discountedAmount . value , 0 ) ;
220+
221+ const totalDiscount = cart . discountedAmount . value + totalLineItemDiscount ;
222+
216223 const giftCertificatesSummary =
217224 checkout ?. giftCertificates . reduce < Array < { code : string ; used : number } > > ( ( acc , c ) => {
218225 acc . push ( {
@@ -278,10 +285,10 @@ export default async function Cart({ params }: Props) {
278285 currency : cart . currencyCode ,
279286 } ) ,
280287 } ,
281- cart . discountedAmount . value > 0
288+ totalDiscount > 0
282289 ? {
283290 label : t ( 'CheckoutSummary.discounts' ) ,
284- value : `-${ format . number ( cart . discountedAmount . value , {
291+ value : `-${ format . number ( totalDiscount , {
285292 style : 'currency' ,
286293 currency : cart . currencyCode ,
287294 } ) } `,
You can’t perform that action at this time.
0 commit comments