diff --git a/framework/commerce/types/cart.ts b/framework/commerce/types/cart.ts index e0d56b3bb..9192436d0 100644 --- a/framework/commerce/types/cart.ts +++ b/framework/commerce/types/cart.ts @@ -122,7 +122,7 @@ export type CartCheckout = { // Discounts that have been applied on the cart. discounts?: Discount[] totalDiscount: number - shippingLine: { + shippingLine?: { priceWithTax: number shippingMethod: ShippingMethod } diff --git a/framework/vendure/api/operations/get-product.ts b/framework/vendure/api/operations/get-product.ts index 66f798ee1..c16041468 100644 --- a/framework/vendure/api/operations/get-product.ts +++ b/framework/vendure/api/operations/get-product.ts @@ -2,7 +2,7 @@ import { Product } from '@commerce/types/product' import { OperationContext } from '@commerce/api/operations' import { Provider, VendureConfig } from '../' import { GetProductQuery } from '../../schema' -import { getProductQuery, getProductDetailQuery } from '../../utils/queries/get-product-query' +import { getProductQuery } from '../../utils/queries/get-product-query' export default function getProductOperation({ commerce, diff --git a/framework/vendure/utils/normalize.ts b/framework/vendure/utils/normalize.ts index 7a2ab0d24..63444b45d 100644 --- a/framework/vendure/utils/normalize.ts +++ b/framework/vendure/utils/normalize.ts @@ -94,10 +94,10 @@ export function normalizeCartForCheckout(order: CartFragment): CartCheckout { countryCode: order.shippingAddress?.countryCode || '', phoneNumber: order.shippingAddress?.phoneNumber || '', }, - shippingLine: { - priceWithTax: order.shippingLines[0].priceWithTax / 100, - shippingMethod: order.shippingLines[0].shippingMethod as ShippingMethod - }, + shippingLine: order.shippingLines[0] ? { + priceWithTax: order.shippingLines[0]?.priceWithTax / 100, + shippingMethod: order.shippingLines[0]?.shippingMethod as ShippingMethod + }: undefined, totalDiscount: order.discounts?.reduce((total, item) => total + item.amountWithTax, 0) / 100 || 0, discounts: order.discounts.map(item => { return { value: item.amountWithTax, description: item.description } diff --git a/src/components/modules/checkout/CheckoutBill/CheckoutBill.tsx b/src/components/modules/checkout/CheckoutBill/CheckoutBill.tsx index 4dae3484b..3e3910c90 100644 --- a/src/components/modules/checkout/CheckoutBill/CheckoutBill.tsx +++ b/src/components/modules/checkout/CheckoutBill/CheckoutBill.tsx @@ -49,7 +49,7 @@ const CheckoutBill = ({ data }: CheckoutBillProps) => {