Customer variables contain authenticated user account information from Shopify including profile data, order history, and marketing preferences. These variables are populated when a user is logged in and are refreshed when the customer signs in/out.
Access in App Studio SDK
Tapcart.variables.customer
Basic Customer Information
Property
Type
Description
Availability
customer.id
string
Unique customer identifier (cleaned of Shopify GID prefix)
When logged in
customer.firstName
string
Customer's first name
When logged in
customer.lastName
string
Customer's last name
When logged in
customer.displayName
string
Customer's display name
When logged in
customer.email
string
Customer's email address
When logged in
customer.phone
string
Customer's phone number
If provided
customer.imageUrl
string
URL to customer's profile image
If available
Account Metadata
Property
Type
Description
Availability
customer.createdAt
string
ISO timestamp when account was created
When logged in
customer.updatedAt
string
ISO timestamp when account was last updated
When logged in
customer.tags
string[]
Array of customer tags for segmentation
If available
Order Information
Property
Type
Description
Availability
customer.orders
object
Connection object containing customer's order history
If available
customer.hasPreviousOrders
boolean
Whether the customer has placed orders before
Always
Default Address
Property
Type
Description
Availability
customer.address.address1
string
Primary address line
If address set
customer.address.address2
string
Secondary address line
If provided
customer.address.city
string
City name
If address set
customer.address.province
string
Province/state name
If address set
customer.address.provinceCode
string
Province/state code
If address set
customer.address.country
string
Country name
If address set
customer.address.countryCode
string
Country code
If address set
customer.address.zip
string
Postal/ZIP code
If address set
Marketing Preferences
Property
Type
Description
Availability
customer.marketing.email
boolean
Whether customer accepts email marketing
If available
customer.marketing.phone
boolean
Whether customer accepts SMS marketing
If available
Session Information
Property
Type
Description
Availability
customer.customerSession
object
Authentication tokens and session data
When logged in
Custom Data
Property
Type
Description
Availability
customer.metafields
array
Array of custom metafield objects with namespace, key, value
Customer variables are only available when a user is authenticated (logged in). When logged out, the customer variable will be undefined. Always check for existence before accessing properties.
Use Cases
Personalization: Display personalized content and recommendations
Order History: Show previous purchases and order status
Shipping: Pre-fill forms with saved address information
Marketing: Respect customer communication preferences
Segmentation: Show different content based on customer tags