Links between Stock Location Module and Other Modules

This document showcases the module links defined between the Stock Location Module and other Commerce Modules.

Summary#

The Stock Location Module has the following links to other modules:

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

First Data Model

Second Data Model

Type

Description

FulfillmentSet in Fulfillment Module

StockLocation

Stored - many-to-one

Learn more

FulfillmentProvider in Fulfillment Module

StockLocation

Stored - many-to-many

Learn more

InventoryLevel in Inventory Module

StockLocation

Read-only - has many

Learn more

SalesChannel in Sales Channel Module

StockLocation

Stored - many-to-many

Learn more


Fulfillment Module#

A fulfillment set can be conditioned to a specific stock location.

Medusa defines a link between the FulfillmentSet and StockLocation data models.

A diagram showcasing an example of how data models from the Fulfillment and Stock Location modules are linked

Medusa also defines a link between the FulfillmentProvider and StockLocation data models to indicate the providers that can be used in a location.

A diagram showcasing an example of how data models from the Fulfillment and Stock Location modules are linked

Retrieve with Query#

To retrieve the fulfillment sets of a stock location with Query, pass fulfillment_sets.* in fields:

Note: To retrieve the fulfillment providers, pass fulfillment_providers.* in fields.

To manage the stock location of a fulfillment set, use Link:


Inventory Module#

Medusa defines a read-only link between the Inventory Module's InventoryLevel data model and the StockLocation data model. Because the link is read-only from the InventoryLevel's side, you can only retrieve the stock location of an inventory level, and not the other way around.

Retrieve with Query#

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


Sales Channel Module#

A stock location is associated with a sales channel. This scopes inventory quantities in a stock location by the associated sales channel.

Medusa defines a link between the SalesChannel and StockLocation data models.

A diagram showcasing an example of how resources from the Sales Channel and Stock Location modules are linked

Retrieve with Query#

To retrieve the sales channels of a stock location with Query, pass sales_channels.* in fields:

To manage the stock locations of a sales channel, use Link:

Was this page helpful?
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