feat(MED-122): fix error in case of cart without shipping

This commit is contained in:
2025-07-17 10:05:55 +03:00
parent 1d0808018b
commit 00b079e170

View File

@@ -9,6 +9,10 @@ type ShippingDetailsProps = {
}
const ShippingDetails = ({ order }: ShippingDetailsProps) => {
if (!order.shipping_methods || order.shipping_methods.length === 0) {
return null;
}
return (
<div>
<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">
{(order as any).shipping_methods[0]?.name} (
{convertToLocale({
amount: order.shipping_methods?.[0].total ?? 0,
amount: order.shipping_methods?.[0]?.total ?? 0,
currency_code: order.currency_code,
})
.replace(/,/g, "")