Order Change

In this document, you'll learn about the Order Change data model and possible actions in it.

OrderChange Data Model#

The OrderChange data model represents any kind of change to an order, such as a return, exchange, or edit.

Its change_type property indicates what the order change is created for:

  1. edit: The order change is making edits to the order, as explained in this guide.
  2. exchange: The order change is associated with an exchange, which you can learn about in this guide.
  3. claim: The order change is associated with a claim, which you can learn about in this guide.
  4. return_request or return_receive: The order change is associated with a return, which you can learn about in this guide.

Once the order change is confirmed, its changes are applied on the order.


Order Change Actions#

The actions to perform on the original order by a change, such as adding an item, are represented by the OrderChangeAction data model.

The OrderChangeAction has an action property that indicates the type of action to perform on the order, and a details property that holds more details related to the action.

The following table lists the possible action values that Medusa uses and what details they carry.

ActionDescriptionDetails

ITEM_ADD

Add an item to the order.

details is an object having the following properties:

  • reference_id: the ID of the new item.
  • quantity: The item's quantity.
  • unit_price: The item's unit price.
  • metadata: The item's metadata.

ITEM_UPDATE

Update an item in the order.

details is an object having the following properties:

  • reference_id: the ID of the item.
  • quantity: The item's quantity.
  • unit_price: The item's unit price.

RETURN_ITEM

Set an item to be returned.

details is an object having the following properties:

  • reference_id: the ID of the item.
  • quantity: The quantity to be returned.
  • reason_id: The ID of the return reason.
  • metadata: The item's metadata.

RECEIVE_RETURN_ITEM

Mark a return item as received.

details is an object having the following properties:

  • reference_id: the ID of the item.
  • quantity: The quantity received. This quantity is added to the inventory quantity of the item's variant when the return is confirmed.

RECEIVE_DAMAGED_RETURN_ITEM

Mark a return item that's damaged as received.

details is an object having the following properties:

  • reference_id: the ID of the item.
  • quantity: The quantity received. This quantity isn't added to the item variant's inventory quantity, as the quantity is damaged.

SHIPPING_ADD

Add a shipping method for new or returned items.

No details added. The ID to the shipping method is added in the reference_id property of the action.

SHIPPING_ADD

Add a shipping method for new or returned items.

No details added. The ID to the shipping method is added in the reference_id property of the action.

WRITE_OFF_ITEM

Remove an item's quantity as part of the claim, without adding the quantity back to the item variant's inventory.

details is an object having the following properties:

  • reference_id: the ID of the item.
  • quantity: The quantity to write off.
  • reason: The claim reason.
Was this page helpful?
Edit this page