Create Customer
Create Customer Mutation
This mutation creates a new customer account in the store with personal information, addresses, and preferences.
Use Cases​
- Customer Registration: Create new customer accounts during signup
- Admin Customer Management: Manually create customer profiles
- Import Operations: Bulk import customers from external systems
- Order Processing: Create customer profiles during checkout
- CRM Integration: Sync customers from external CRM systems
Key Features​
Customer Information​
- Personal Details: First name, last name, email, and phone
- Account Status: Active/inactive status and verification state
- Localization: Language and regional preferences
- Contact Preferences: Marketing and communication settings
Address Management​
- Multiple Addresses: Support for shipping and billing addresses
- Geographic Data: Country, state, city, and region information
- Contact Details: Phone numbers and delivery notes
- Address Validation: Ensure proper geographic relationships
Customer Segmentation​
- Tags: Categorize customers for marketing and analysis
- Preferences: Store customer preferences and settings
- Order History: Track customer purchase behavior
- Loyalty Status: Manage VIP and loyalty program memberships
Input Parameters​
$input: CustomerInput!- Complete customer information including:storeId: Store identifier where the customer will be createdfirstName: Customer's first namelastName: Customer's last nameemail: Primary email address (must be unique)phone: Primary phone numberisActive: Whether the customer account is activelocale: Customer's preferred languageaddresses: Array of customer addressestags: Customer tags for segmentationpreferences: Customer preferences and settings
Response Structure​
The mutation would return a CreateCustomerPayload containing:
customer: Complete customer object with all created data- Generated customer ID and timestamps
- Associated addresses and preferences
- Order history and account status
Customer Fields Detail​
Basic Information​
id- Unique customer identifierfirstName/lastName- Customer nameemail- Primary email addressphone- Primary phone numberisActive- Account statusisVerified- Email/phone verification statuslocale- Preferred languagecreatedAt/updatedAt- Account timestamps
Associated Data​
addresses- Customer addresses with geographic dataorders- Order history with basic order informationtags- Customer segmentation tagspreferences- Account and marketing preferences
Example Response​
{
"data": {
"createCustomer": {
"customer": {
"id": "Customer_john_smith_001",
"firstName": "John",
"lastName": "Smith",
"email": "john.smith@example.com",
"phone": "+1-555-123-4567",
"isActive": true,
"isVerified": false,
"locale": "en",
"createdAt": "2024-01-15T10:30:00Z",
"updatedAt": "2024-01-15T10:30:00Z",
"addresses": [
{
"id": "Address_001",
"addressLine1": "123 Main Street",
"addressLine2": "Apt 4B",
"phone": "+1-555-123-4567",
"postalCode": "10001",
"areaSnapshot": {
"cityName": "New York",
"stateName": "New York",
"countryName": "United States"
}
}
],
"orders": {
"totalCount": 0,
"nodes": []
},
"tags": [
{
"id": "Tag_vip_001",
"name": "VIP",
"color": "#FFD700"
}
]
}
}
}
}
Implementation Notes​
Validation Requirements​
- Email address must be unique within the store
- Phone number format validation
- Address geographic data must be valid
- Required fields must be provided
Best Practices​
- Implement email verification workflows
- Validate phone numbers with proper formatting
- Use proper address validation services
- Set up customer segmentation from creation
- Configure appropriate privacy settings
Error Handling​
- Handle duplicate email addresses gracefully
- Validate geographic data relationships
- Check store customer limits
- Ensure proper data privacy compliance
Security Considerations​
- Hash and secure sensitive customer data
- Implement proper access controls
- Follow data privacy regulations (GDPR, CCPA)
- Set up audit trails for customer data changes
Alternative Implementation​
Since this mutation may not be directly available, customer creation might happen through:
- Order Creation: Customers created automatically during checkout
- Authentication System: Customer registration through auth flows
- Import Tools: Bulk customer import functionality
- Admin Interface: Manual customer creation through admin panels
Related Operations​
updateCustomer- Update existing customer informationcreateOrder- Create orders for customersaddCustomerAddress- Add addresses to customer accountstagCustomer- Add tags to customers for segmentation
GraphQL Endpoint​
https://graphql.wuilt.com
Operation: CreateCustomer​
Try It Out​
Query​
Query Variables
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
Note: Make sure to change the storeId with your store ID. For guidance on how to get your store ID, reference the Store ID guide.
Authentication​
To use this query, you will need an API key. Click the "API Key" button in the navigation bar to enter your credentials.