Skip to main content
Skip to main content

Inventory Module in Medusa Flows

This document explains how the Inventory Module is used within the Medusa application's flows.

Product Variant Creation

When a product variant is created and its manage_inventory attribute's value is true, the Medusa application uses the Inventory Module to create an inventory item associated with that product variant.

A diagram showcasing how the Inventory Module is used in the product variant creation form


Add to Cart

When a product variant with manage_inventory set to true is added to cart, the Medusa application uses the Inventory Module to check whether there's sufficient stocked quantity. If not, an error is thrown and the product variant won't be added to the cart.

A diagram showcasing how the Inventory Module is used in the add to cart flow


Order Placed

When an order is placed, the Medusa application uses the Inventory Module to create a reservation item for each product variant with manage_inventory set to true. It also sets the reserved_quantity of the inventory level associated with the inventory item to the ordered quantity of that item.

A diagram showcasing how the Inventory Module is used in the order placed flow


Order Fulfillment

When an item in an order is fulfilled and the associated variant has its manage_inventory attribute set to true, the Medusa application uses the Inventory Module to:

  • Subtract the reserved_quantity from the stocked_quantity in the inventory level associated with the variant's inventory item.
  • Reset the reserved_quantity to 0.
  • Delete the associated reservation item.

A diagram showcasing how the Inventory Module is used in the order fulfillment flow


Order Return

When an item in an order is returned and the associated variant has its manage_inventory attribute set to true, the Medusa application uses the Inventor Module to increment the stocked_quantity of the inventory level associated with the inventory item with the returned quantity.

A diagram showcasing how the Inventory Module is used in the order return flow

Was this section helpful?