use Emailhook
hook
Requires level 2 access to protected customer data.
Returns the email address of the buyer that is interacting with the cart.
The value is undefined
if the app does not have access to customer data.
Anchor to useEmailuse Email()
use Email()
Anchor to useEmail-returnsReturns
string | undefined
UseEmailGeneratedType
Returns the email address of the buyer that is interacting with the cart. The value is `undefined` if the app does not have access to customer data.
string | undefined
export function useEmail<
ID extends RenderExtensionPoint = RenderExtensionPoint,
>(): string | undefined {
const buyerIdentity = useApi<ID>().buyerIdentity;
if (!buyerIdentity) {
throw new ScopeNotGrantedError(
'Using buyer identity requires having personal customer data permissions granted to your app.',
);
}
return useSubscription(buyerIdentity.email);
}
Was this section helpful?