Links between Inventory Module and Other Modules

This document showcases the module links defined between the Inventory Module and other commerce modules.

Summary#

The Inventory Module has the following links to other modules:

TipRead-only links are used to query data across modules, but the relations aren't stored in a pivot table in the database.

Product Module#

Each product variant has different inventory details. Medusa defines a link between the ProductVariant and InventoryItem data models.

A diagram showcasing an example of how data models from the Inventory and Product Module are linked.

A product variant whose manage_inventory property is enabled has an associated inventory item. Through that inventory's items relations in the Inventory Module, you can manage and check the variant's inventory quantity.

TipLearn more about product variant's inventory management in this guide.

Retrieve with Query#

To retrieve the product variants of an inventory item with Query, pass variants.* in fields:

To manage the variants of an inventory item, use Link:


Stock Location Module#

Medusa defines a read-only link between the InventoryLevel data model and the Stock Location Module's StockLocation data model. This means you can retrieve the details of an inventory level's stock locations, but you don't manage the links in a pivot table in the database. The stock location of an inventory level is determined by the location_id property of the InventoryLevel data model.

Retrieve with Query#

To retrieve the stock locations of an inventory level with Query, pass stock_locations.* in fields:

Was this page helpful?
Edit this page
Ask Anything
FAQ
What is Medusa?
How can I create a module?
How can I create a data model?
How do I create a workflow?
How can I extend a data model in the Product Module?
Recipes
How do I build a marketplace with Medusa?
How do I build digital products with Medusa?
How do I build subscription-based purchases with Medusa?
What other recipes are available in the Medusa documentation?
Chat is cleared on refresh
Line break