-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: improve commerce modules [3/n] (#9510)
Improve and add docs for Order and Payment modules [3/n] Closes DOCS-966 Closes #9485
- Loading branch information
1 parent
74b286b
commit 11120a8
Showing
30 changed files
with
662 additions
and
314 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
www/apps/resources/app/commerce-modules/order/edit/page.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
export const metadata = { | ||
title: `Order Edit`, | ||
} | ||
|
||
# {metadata.title} | ||
|
||
In this document, you'll learn about order edits. | ||
|
||
## What is an Order Edit? | ||
|
||
A merchant can edit an order to add new items or change the quantity of existing items in the order. | ||
|
||
An order edit is represented by the [OrderChange data model](/references/order/models/OrderChange). | ||
|
||
The `OrderChange` data model is associated with any type of change, including a return or exchange. However, its `change_type` property distinguishes the type of change it's making. | ||
|
||
In the case of an order edit, the `OrderChange`'s type is `edit`. | ||
|
||
--- | ||
|
||
## Add Items in an Order Edit | ||
|
||
When the merchant adds new items to the order in the order edit, the item is added as an [OrderItem](/references/order/models/OrderItem). | ||
|
||
Also, an `OrderChangeAction` is created. The [OrderChangeAction data model](/references/order/models/OrderChangeAction) represents a change made by an `OrderChange`, such as an item added. | ||
|
||
So, when an item is added, an `OrderChangeAction` is created with the type `ITEM_ADD`. In its `details` property, the item's ID, price, and quantity are stored. | ||
|
||
--- | ||
|
||
## Update Items in an Order Edit | ||
|
||
A merchant can update an existing item's quantity or price. | ||
|
||
This change is added as an `OrderChangeAction` with the type `ITEM_UPDATE`. In its `details` property, the item's ID, new price, and new quantity are stored. | ||
|
||
--- | ||
|
||
## Shipping Methods of New Items in the Edit | ||
|
||
Adding new items to the order requires adding shipping methods for those items. | ||
|
||
These shipping methods are represented by the [OrderShippingMethod data model](/references/order/models/OrderItem). Also, an `OrderChangeAction` is created with the type `SHIPPING_ADD` | ||
|
||
--- | ||
|
||
## How Order Edits Impact an Order’s Version | ||
|
||
When an order edit is confirmed, the order’s version is incremented. | ||
|
||
--- | ||
|
||
## Payments and Refunds for Order Edit Changes | ||
|
||
Once the Order Edit is confirmed, any additional payment or refund required can be made on the original order. | ||
|
||
This is determined by the comparison between the `OrderSummary` and the order's transactions, as mentioned in [this guide](../transactions/page.mdx#checking-outstanding-amount). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
www/apps/resources/app/commerce-modules/order/links-to-other-modules/page.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
export const metadata = { | ||
title: `Links between Order Module and Other Modules`, | ||
} | ||
|
||
# {metadata.title} | ||
|
||
This document showcases the module links defined between the Order Module and other commerce modules. | ||
|
||
## Cart Module | ||
|
||
The Cart Module provides cart-management features. | ||
|
||
Medusa defines a link between the `Order` and `Cart` data models. The order is linked to the cart used for the purchased. | ||
|
||
![A diagram showcasing an example of how data models from the Cart and Order modules are linked](https://res.cloudinary.com/dza7lstvk/image/upload/v1728375735/Medusa%20Resources/cart-order_ijwmfs.jpg) | ||
|
||
--- | ||
|
||
## Fulfillment Module | ||
|
||
A fulfillment is created for an orders' items. Medusa defines a link between the `Fulfillment` and `Order` data models. | ||
|
||
![A diagram showcasing an example of how data models from the Fulfillment and Order modules are linked](https://res.cloudinary.com/dza7lstvk/image/upload/v1716549903/Medusa%20Resources/order-fulfillment_h0vlps.jpg) | ||
|
||
|
||
A fulfillment is also created for a return's items. So, Medusa defines a link between the `Fulfillment` and `Return` data models. | ||
|
||
![A diagram showcasing an example of how data models from the Fulfillment and Order modules are linked](https://res.cloudinary.com/dza7lstvk/image/upload/v1728399052/Medusa%20Resources/Social_Media_Graphics_2024_Order_Return_vetimk.jpg) | ||
|
||
--- | ||
|
||
## Payment Module | ||
|
||
An order's payment details are stored in a payment collection. This also applies for claims and exchanges. | ||
|
||
So, Medusa defines links between the `PaymentCollection` data model and the `Order`, `OrderClaim`, and `OrderExchange` data models. | ||
|
||
![A diagram showcasing an example of how data models from the Order and Payment modules are linked](https://res.cloudinary.com/dza7lstvk/image/upload/v1716554726/Medusa%20Resources/order-payment_ubdwok.jpg) | ||
|
||
--- | ||
|
||
## Promotion Module | ||
|
||
An order is associated with the promotion applied on it. Medusa defines a link between the `Order` and `Promotion` data models. | ||
|
||
![A diagram showcasing an example of how data models from the Order and Promotion modules are linked](https://res.cloudinary.com/dza7lstvk/image/upload/v1716555015/Medusa%20Resources/order-promotion_dgjzzd.jpg) |
Oops, something went wrong.