2.0 Beta

Smootify 2.0 is in public beta. Your 1.x store keeps working. Move when you want.

What changed

smootify:user_auth_change

the session is known or changed: the customer, null for a guest

v2.0 beta
Open .md
On this page
  1. Listen
  2. Payload
  3. Customer

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 | null

Customer

/** 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;
}

    ↑ ↓ to moveEnter to openEsc to close