Skip to content

CheckoutReturningCustomer

"Welcome back" under the checkout's email, for an address that has an account: a password and a secondary "Sign in", so the section's own continue stays the one primary action and guest checkout the main path. "Not now" hides it. It sits in the details form, so it renders no form, and Enter signs in rather than submitting.

import { CheckoutReturningCustomer } from "@evolve-storefront/feature-auth/checkout-returning-customer";

Renders inside AuthProvider.

Preview

Sign InOpen in Storybook ↗

Usage

A known address gets the prompt: sign in from it, with one secondary button, or ignore it with "Not now". An unknown address or a failed lookup shows nothing.

const customer = useReturningCustomer({ onSignedIn: () => router.refresh() });
<CheckoutDetailsSection
cart={cart}
onEmailSettled={customer.lookUp}
account={
<CheckoutReturningCustomer
customer={customer}
forgotPassword={<Link href="/account/password-reset">{t("forgot")}</Link>}
/>
}
/>;

Props

PropTypeDescription
customerReturningCustomer

What useReturningCustomer returns.

forgotPassword?ReactNode

Beside the button: the site's link to reset the password.

Any other props go to the root element, like on a plain HTML element.