Customer Module

The Customer Module provides customer-related features in your Medusa and Node.js applications.

How to Use Customer Module's Service#

You can use the Customer Module's main service by resolving from the Medusa container the resource Modules.CUSTOMER imported from @medusajs/framework/utils.

For example:


Features#

Customer Management#

With the Customer Module, store and manage customers.

Code
1const customer = await customerModuleService.createCustomers({2  first_name: "Peter",3  last_name: "Hayes",4  email: "peter.hayes@example.com",5})

Customer Organization#

Organize customers into groups.

This has a lot of benefits and supports many use cases, such as provide discounts for specific customer groups using the Promotion Module.

Code
1const customerGroup = await customerModuleService.createCustomerGroups({2  name: "VIP",3})4
5await customerModuleService.addCustomerToGroup({6  customer_id: "cus_123",7  customer_group_id: customerGroup.id,8})
Was this page helpful?
Edit this page