Skip to main content
Glama
customer.md2.29 kB
# Customer Object ## Overview The `customer` object represents a store customer and is accessible globally when they're logged in. It's defined in: - `customers/account` template - `customers/addresses` template - `customers/order` template - `checkout.customer` context - `gift_card.customer` context - `order.customer` context Outside these contexts, an unlogged customer returns `nil`. ## Properties | Property | Type | Description | |----------|------|-------------| | `accepts_marketing` | boolean | Indicates marketing consent status | | `addresses` | array of address | All customer addresses (paginate up to 20) | | `addresses_count` | number | Total addresses associated | | `b2b?` | boolean | B2B customer status | | `company_available_locations` | array of company_location | Accessible company locations (paginate up to 100) | | `company_available_locations_count` | number | Count of accessible locations | | `current_company` | company | Company customer is purchasing for | | `current_location` | company_location | Selected company location | | `default_address` | address | Primary customer address | | `email` | string | Customer email | | `first_name` | string | Given name | | `has_account` | boolean | Whether email is tied to a customer account | | `has_avatar?` | boolean | Avatar existence status | | `id` | number | Customer identifier | | `last_name` | string | Family name | | `last_order` | order | Most recent order (excluding test orders) | | `name` | string | Full name | | `orders` | array of order | All customer orders (paginate up to 20) | | `orders_count` | number | Total orders placed | | `payment_methods` | array of customer_payment_method | Saved payment methods | | `phone` | string | Phone number (populated if provided during checkout or SMS opt-in) | | `store_credit_account` | store_credit_account | Store credit in current currency context | | `tags` | array of string | Associated customer tags | | `tax_exempt` | boolean | Tax exemption status | | `total_spent` | number | Lifetime spending in currency subunits | ## Checking If Object Is Defined Always verify the customer object exists before accessing properties outside dedicated customer templates: ```liquid {% if customer %} Hello, {{ customer.first_name }}! {% endif %} ```

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/florinel-chis/shopify-liquid-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server