Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Handle users that have no addresses at all

dominik-zeglen30c8a1a7fa60
diff --git a/saleor/static/dashboard-next/customers/components/CustomerAddresses/CustomerAddresses.tsx b/saleor/static/dashboard-next/customers/components/CustomerAddresses/CustomerAddresses.tsx
index 150634ccbf..4931d9c87e 100644
--- a/saleor/static/dashboard-next/customers/components/CustomerAddresses/CustomerAddresses.tsx
+++ b/saleor/static/dashboard-next/customers/components/CustomerAddresses/CustomerAddresses.tsx
@@ -80,6 +80,13 @@ const CustomerAddresses = withStyles(styles, { name: "CustomerAddresses" })(
</CardContent>
)}
</>
+ ) : maybe(() => customer.defaultBillingAddress) === null &&
+ maybe(() => customer.defaultShippingAddress) === null ? (
+ <CardContent>
+ <Typography>
+ {i18n.t("This customer has no addresses yet")}
+ </Typography>
+ </CardContent>
) : (
<CardContent>
<Typography className={classes.label}>{i18n.t("Address")}</Typography>
diff --git a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx b/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx
index 2bac088126..5303561fb0 100644
--- a/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx
+++ b/saleor/static/dashboard-next/storybook/stories/customers/CustomerDetailsPage.tsx
@@ -93,4 +93,14 @@ storiesOf("Views / Customers / Customer details", module)
defaultShippingAddress: null
}}
/>
+ ))
+ .add("no address at all", () => (
+ <CustomerDetailsPage
+ {...props}
+ customer={{
+ ...customer,
+ defaultBillingAddress: null,
+ defaultShippingAddress: null
+ }}
+ />
));