From a8678bdecd669b18872ce77cad443f48b2bafc18 Mon Sep 17 00:00:00 2001 From: Zaiste Date: Thu, 29 Apr 2021 21:15:01 +0200 Subject: [PATCH] saleor: fix the prices in the cart --- framework/saleor/utils/normalize.ts | 4 ++-- .../saleor/utils/queries/get-checkout-query.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/framework/saleor/utils/normalize.ts b/framework/saleor/utils/normalize.ts index d48ad8c2f..426b296f3 100644 --- a/framework/saleor/utils/normalize.ts +++ b/framework/saleor/utils/normalize.ts @@ -119,8 +119,8 @@ export function normalizeCart(checkout: Checkout): Cart { }, taxesIncluded: false, lineItems, - lineItemsSubtotalPrice: 0, - subtotalPrice: 0, + lineItemsSubtotalPrice: checkout.subtotalPrice?.gross?.amount!, + subtotalPrice: checkout.subtotalPrice?.gross?.amount!, totalPrice: checkout.totalPrice?.gross.amount!, discounts: [], } diff --git a/framework/saleor/utils/queries/get-checkout-query.ts b/framework/saleor/utils/queries/get-checkout-query.ts index a054e6f9f..524718bb8 100644 --- a/framework/saleor/utils/queries/get-checkout-query.ts +++ b/framework/saleor/utils/queries/get-checkout-query.ts @@ -3,6 +3,19 @@ export const checkoutDetailsFragment = ` token created + totalPrice { + currency + gross { + amount + } + } + subtotalPrice { + currency + gross { + amount + } + } + lines { id variant {