feat(MED-122): fix error in case of cart without shipping
This commit is contained in:
@@ -9,6 +9,10 @@ type ShippingDetailsProps = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const ShippingDetails = ({ order }: ShippingDetailsProps) => {
|
const ShippingDetails = ({ order }: ShippingDetailsProps) => {
|
||||||
|
if (!order.shipping_methods || order.shipping_methods.length === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<Heading level="h2" className="flex flex-row text-3xl-regular my-6">
|
<Heading level="h2" className="flex flex-row text-3xl-regular my-6">
|
||||||
@@ -58,7 +62,7 @@ const ShippingDetails = ({ order }: ShippingDetailsProps) => {
|
|||||||
<Text className="txt-medium text-ui-fg-subtle">
|
<Text className="txt-medium text-ui-fg-subtle">
|
||||||
{(order as any).shipping_methods[0]?.name} (
|
{(order as any).shipping_methods[0]?.name} (
|
||||||
{convertToLocale({
|
{convertToLocale({
|
||||||
amount: order.shipping_methods?.[0].total ?? 0,
|
amount: order.shipping_methods?.[0]?.total ?? 0,
|
||||||
currency_code: order.currency_code,
|
currency_code: order.currency_code,
|
||||||
})
|
})
|
||||||
.replace(/,/g, "")
|
.replace(/,/g, "")
|
||||||
|
|||||||
Reference in New Issue
Block a user