smootify:user_auth_change
the session is known or changed: the customer, null for a guest
the session is known or changed: the customer, null for a guest Since 1.x.
Listen
window.Smootify = window.Smootify || [];
window.Smootify.push((api) => {
api.on("user_auth_change", (payload) => {
// …
});
});Payload
Customer | nullCustomer
/** The logged-in customer (Shopify's customer accounts). */
export interface Customer {
/** `gid://shopify/Customer/<id>` */
id: string;
displayName: string;
firstName?: string | null;
lastName?: string | null;
tags: string[];
emailAddress?: { emailAddress: string; marketingState: MarketingState } | null;
phoneNumber?: { phoneNumber: string; marketingState: MarketingState } | null;
defaultAddress?: { id: string; name?: string | null; formatted: string[] | string } | null;
metafields: (CustomerMetafield | null)[];
companyContacts?: {
nodes: {
company: { id: string; name: string; metafields: (CustomerMetafield | null)[] } | null;
locations: { nodes: { id: string }[] };
}[];
} | null;
}