diff --git a/.changeset/perfect-spies-cheat.md b/.changeset/perfect-spies-cheat.md
new file mode 100644
index 000000000..72cd76f17
--- /dev/null
+++ b/.changeset/perfect-spies-cheat.md
@@ -0,0 +1,5 @@
+---
+"@bigcommerce/catalyst-core": patch
+---
+
+Use amount and discount values for cart summary in Cart page
diff --git a/apps/core/app/[locale]/(default)/cart/_components/checkout-summary.tsx b/apps/core/app/[locale]/(default)/cart/_components/checkout-summary.tsx
index 62ad91004..c6425f9a3 100644
--- a/apps/core/app/[locale]/(default)/cart/_components/checkout-summary.tsx
+++ b/apps/core/app/[locale]/(default)/cart/_components/checkout-summary.tsx
@@ -127,7 +127,7 @@ export const CheckoutSummary = ({
{t('discounts')}
- {currencyFormatter.format(checkoutSummary.totalDiscountedAmount.value)}
+ -{currencyFormatter.format(checkoutSummary.discountedAmount.value)}
@@ -135,7 +135,7 @@ export const CheckoutSummary = ({
{t('grandTotal')}
{currencyFormatter.format(
- checkoutSummary.totalExtendedSalePrice.value +
+ checkoutSummary.amount.value +
checkoutSummary.shippingCostTotal.value +
checkoutSummary.handlingCostTotal.value,
)}
diff --git a/apps/core/client/queries/get-cart.ts b/apps/core/client/queries/get-cart.ts
index 61fd695d8..52217e8f2 100644
--- a/apps/core/client/queries/get-cart.ts
+++ b/apps/core/client/queries/get-cart.ts
@@ -28,9 +28,6 @@ export const GET_CART_QUERY = /* GraphQL */ `
extendedSalePrice {
...MoneyFields
}
- discountedAmount {
- ...MoneyFields
- }
selectedOptions {
__typename
entityId
@@ -60,6 +57,12 @@ export const GET_CART_QUERY = /* GraphQL */ `
}
}
}
+ amount {
+ ...MoneyFields
+ }
+ discountedAmount {
+ ...MoneyFields
+ }
}
}
}
@@ -91,27 +94,11 @@ export const getCart = cache(async (cartId?: string) => {
return acc + item.extendedListPrice.value;
}, 0);
- const totalDiscountedAmount = cart.lineItems.physicalItems.reduce((acc, item) => {
- return acc + item.discountedAmount.value;
- }, 0);
-
- const totalExtendedSalePrice = cart.lineItems.physicalItems.reduce((acc, item) => {
- return acc + item.extendedSalePrice.value;
- }, 0);
-
return {
...cart,
totalExtendedListPrice: {
currencyCode: cart.currencyCode,
value: totalExtendedListPrice,
},
- totalDiscountedAmount: {
- currencyCode: cart.currencyCode,
- value: totalDiscountedAmount,
- },
- totalExtendedSalePrice: {
- currencyCode: cart.currencyCode,
- value: totalExtendedSalePrice,
- },
};
});