docs: edits and fixes to commerce module docs (#7468)

Apply edits and fixes to the commerce modules docs
This commit is contained in:
Shahed Nasser authored and GitHub committed 2024-05-29 11:08:06 +00:00
1 parent 130de74d6d
commit 2c5ba408d4
160 files changed
+6400 -3790

No files matched your search

@@ -8,7 +8,7 @@ In this document, you’ll learn how registered and unregistered accounts are di
## `has_account` field
The `Customer` data model has a `has_account` field, which is a boolean that indicates whether a customer is registerd.
The [Customer data model](/references/customer/models/Customer) has a `has_account` field, which is a boolean that indicates whether a customer is registerd.
When a guest customer places an order, a new `Customer` record is created with `has_account` set to `false`.
@@ -20,4 +20,4 @@ When this or another guest customer registers an account with the same email, a
The above behavior means that two `Customer` records may exist of the same email. However, the main difference is the `has_account` field’s value.
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email. If another customer tries to create an account with the same email, they’ll get an error that an account with this email already exists.
So, there can only be one guest customer (having `has_account=false`) and one registered customer (having `has_account=true`) with the same email.
@@ -8,4 +8,10 @@ export const metadata = {
Find in this reference the list of events emitted by the Customer Module.
<Note type="soon">
Events are still in development, so this reference will change in the future.
</Note>
<EventsTable />
@@ -233,4 +233,4 @@ In this guide, you’ll find common examples of how you can use the Customer Mod
## More Examples
The [module interface reference](/references/customer) provides a reference to all the methods available for use with examples for each.
The [Customer Module's main service reference](/references/customer) provides a reference to all the methods available for use with examples for each.
@@ -42,14 +42,16 @@ await customerModuleService.addCustomerToGroup({
## Configure Customer Module
After installing the `@medusajs/customer` package in your Medusa application, add it to the `modules` object in `medusa-config.js`:
To use the Customer Module, enable it in the `modules` object in `medusa-config.js`:
```js title="medusa-config.js"
const { Modules } = require("@medusajs/modules-sdk")
// ...
const modules = {
// ...
customer: {
resolve: "@medusajs/customer",
},
[Modules.CUSTOMER]: true,
}
```
@@ -108,9 +110,11 @@ For example:
import { ICustomerModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/modules-sdk"
const step1 = createStep("step-1", async (_, context) => {
const step1 = createStep(
"step-1",
async (_, { container }) => {
const customerModuleService: ICustomerModuleService =
context.container.resolve(ModuleRegistrationName.PRODUCT)
container.resolve(ModuleRegistrationName.CUSTOMER)
const customers = await customerModuleService.list()
})
@@ -4,13 +4,19 @@ export const metadata = {
# {metadata.title}
When Commerce Modules are used together in a Medusa application, the Medusa application handles building the relations between these modules.
This document showcases the relation between the Customer Module and other Commerce Modules.
This document showcases the link modules defined between the Customer Module and other commerce modules.
## Cart Module
A customer has a cart to purchase items from the store. The Medusa application forms a relation between the `Customer` and the `Cart` data models.
A customer has a cart to purchase items from the store. Medusa defines a link module that builds a relationship between the `Customer` and the `Cart` data models.
![A diagram showcasing an example of how resources from the Customer and Cart modules are linked](https://res.cloudinary.com/dza7lstvk/image/upload/v1709915775/Medusa%20Resources/customer-cart_by5e7s.jpg)
![A diagram showcasing an example of how data models from the Customer and Cart modules are linked](https://res.cloudinary.com/dza7lstvk/image/upload/v1711537276/Medusa%20Resources/cart-customer_pnjvuw.jpg)
---
## Order Module
A customer is associated with the orders they place. Medusa defines a link module that builds a relationship between the `Customer` and the `Order` data models.
![A diagram showcasing an example of how data models from the Customer and Order modules are linked](https://res.cloudinary.com/dza7lstvk/image/upload/v1716545470/Medusa%20Resources/customer-order_pkla6f.jpg)