Overview
The Customer Module manages customer data including profiles, addresses, and customer group memberships. It provides essential customer relationship management capabilities for your commerce platform. Key Features:- Customer profile management
- Multiple address support
- Customer groups for segmentation
- Account and guest customer tracking
- Searchable customer data
- Custom metadata storage
When to Use
Use the Customer Module when you need to:- Create and manage customer profiles
- Store customer contact information
- Manage multiple shipping addresses per customer
- Organize customers into groups
- Track registered vs. guest customers
- Store custom customer attributes
- Search customers by name, email, or phone
Data Models
Customer
The core customer entity representing a person or business.string
required
Unique customer identifier (prefix:
cus_)string
Customer email address (searchable)
string
Customer first name (searchable)
string
Customer last name (searchable)
string
Company name for B2B customers (searchable)
string
Customer phone number (searchable)
boolean
Whether customer has a registered account (default: false)
string
ID of user who created the customer record
object
Additional custom data
CustomerAddress[]
Customer shipping/billing addresses
CustomerGroup[]
Customer groups this customer belongs to
CustomerAddress
Represents a saved customer address.string
required
Unique address identifier
string
required
ID of the parent customer
string
Name for this address (e.g., “Home”, “Office”)
boolean
Whether this is the default shipping address
boolean
Whether this is the default billing address
string
First name
string
Last name
string
Phone number
string
Company name
string
Address line 1
string
Address line 2
string
City
string
Two-letter ISO country code
string
State or province
string
Postal/ZIP code
object
Additional custom data
CustomerGroup
Groups customers for segmentation and targeting.string
required
Unique customer group identifier
string
required
Customer group name
object
Additional custom data
Customer[]
Customers in this group
CustomerGroupCustomer
Join entity for many-to-many customer-group relationship.string
required
Unique relationship identifier
string
required
ID of the customer
string
required
ID of the customer group
Service Interface
The Customer Module service is available at@medusajs/medusa/customer.
Retrieve Customer
Retrieve a single customer with related data.string
required
The ID of the customer to retrieve
FindConfig
CustomerDTO
The retrieved customer
List Customers
List customers with filtering and search.FilterableCustomerProps
CustomerDTO[]
Array of customers matching the filters
number
Total count of matching customers
Create Customers
Create one or more customer profiles.CreateCustomerDTO | CreateCustomerDTO[]
required
CustomerDTO | CustomerDTO[]
The created customer(s)
Update Customers
Update customer information.string | string[] | FilterableCustomerProps
required
Customer ID(s) or filter selector
CustomerUpdatableFields
required
Fields to update
Create Customer Addresses
Add addresses to a customer.CreateCustomerAddressDTO | CreateCustomerAddressDTO[]
required
Update Customer Addresses
Modify existing addresses.Delete Customer Addresses
Remove addresses from a customer.Create Customer Groups
Create customer groups for segmentation.CreateCustomerGroupDTO | CreateCustomerGroupDTO[]
required
Add Customers to Group
Assign customers to a customer group.GroupCustomerPair | GroupCustomerPair[]
required
Remove Customers from Group
Remove customer group associations.Integration Examples
With Cart Module
Associate carts with customers.With Order Module
Link orders to customers.With Auth Module
Manage customer authentication.With Pricing Module
Customer group-based pricing.Best Practices
-
Email Uniqueness: Enforce unique emails for accounts by using the
has_accountflag. Guests can share emails, but registered customers must have unique email/has_account combinations. -
Address Management: Use
is_default_shippingandis_default_billingto mark primary addresses for quick access. -
Customer Groups: Leverage customer groups for:
- Price list targeting
- Promotion eligibility
- Custom business logic
- Reporting and analytics
- Searchable Fields: Take advantage of searchable fields (email, first_name, last_name, company_name, phone) for customer lookup.
-
Guest to Account Conversion: When converting a guest to a registered customer, update
has_accounttotrueand ensure email uniqueness. - Metadata Usage: Store custom attributes in metadata for flexibility without schema changes.
Related Modules
- Cart Module - Associate carts with customers
- Order Module - Track customer orders
- Auth Providers - Customer authentication
- Pricing Module - Customer group pricing