Skip to main content
Skip to main content

Order Versioning

In this document, you’ll learn how an order and its details are versioned.

What's Versioning?

Versioning means assigning a version number to a record, such as an order and its items. This is useful to view the different versions of the order following changes in its lifetime.


version Attribute

The Order and OrderSummary data models have a version attribute that indicates the current order version. By default, its value is 1.

The OrderItem data model also has a version attribute, but it indicates the version it belongs to. For example, original items in the order have version 1. Then, when a new item is added, its version is 2. If an existing item is modified, such as its quantity has been changed, its version is updated.


Order Change Versioning

The OrderChange and OrderChangeAction data models also have a version attribute. When an order change is created, the version attribute’s value is the associated order’s version incremented.

So, if the order’s version is 1, the order change’s version is 2.

Then, once the order change is confirmed and applied to the order, the versions of the order and order summary change to that of the order change.

Order items change depending on the version they were added or modified in, as explained in the earlier section.

https://res.cloudinary.com/dza7lstvk/image/upload/v1712304242/Medusa%20Resources/order-versioning_rsx2rn.jpg

Was this section helpful?