Links between Product Module and Other Modules

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

Summary#

The Product 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

LineItem in Cart Module

Product

Read-only - has one

Learn more

Product

ShippingProfile in Fulfillment Module

Stored - many-to-one

Learn more

ProductVariant

InventoryItem in Inventory Module

Stored - many-to-many

Learn more

OrderLineItem in Order Module

Product

Read-only - has one

Learn more

ProductVariant

PriceSet in Pricing Module

Stored - one-to-one

Learn more

Product

SalesChannel in Sales Channel Module

Stored - many-to-many

Learn more

Product

Translation in Translation Module

Read-only - one-to-many

Learn more

ProductVariant

Translation in Translation Module

Read-only - one-to-many

Learn more

ProductCategory

Translation in Translation Module

Read-only - one-to-many

Learn more

ProductCollection

Translation in Translation Module

Read-only - one-to-many

Learn more

ProductTag

Translation in Translation Module

Read-only - one-to-many

Learn more

ProductType

Translation in Translation Module

Read-only - one-to-many

Learn more

ProductOption

Translation in Translation Module

Read-only - one-to-many

Learn more

ProductOptionValue

Translation in Translation Module

Read-only - one-to-many

Learn more


Cart Module#

Medusa defines read-only links between:

  • The Cart Module's LineItem data model and the Product data model. Because the link is read-only from the LineItem's side, you can only retrieve the product of a line item, and not the other way around.
  • The ProductVariant data model and the Cart Module's LineItem data model. Because the link is read-only from the LineItem's side, you can only retrieve the variant of a line item, and not the other way around.

Retrieve with Query#

To retrieve the variant of a line item with Query, pass variant.* in fields:

Note: To retrieve the product, pass product.* in fields.

Fulfillment Module#

Medusa defines a link between the Product data model and the ShippingProfile data model of the Fulfillment Module. Each product must belong to a shipping profile.

Note: This link is introduced in Medusa v2.5.0.

Retrieve with Query#

To retrieve the shipping profile of a product with Query, pass shipping_profile.* in fields:

To manage the shipping profile of a product, use Link:


Inventory Module#

The Inventory Module provides inventory-management features for any stock-kept item.

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

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

When the manage_inventory property of a product variant is enabled, you can manage the variant's inventory in different locations through this relation.

Tip: Learn more about product variant's inventory management in this guide.

Retrieve with Query#

To retrieve the inventory items of a product variant with Query, pass inventory_items.inventory.* in fields. The inventory_items relation holds link records, so use inventory_items.inventory to access the actual InventoryItem data:

You can also traverse from the product entity through its variants to their inventory items:

Note: Creating a product variant with manage_inventory enabled creates an inventory item automatically, but does not create inventory levels. You must create inventory levels separately to set the stocked quantity at a specific location. Refer to the Inventory Module's documentation for details.

To manage the inventory items of a variant, use Link:


Order Module#

Medusa defines read-only links between:

  • the Order Module's OrderLineItem data model and the Product data model. Because the link is read-only from the OrderLineItem's side, you can only retrieve the product of an order line item, and not the other way around.
  • the Order Module's OrderLineItem data model and the ProductVariant data model. Because the link is read-only from the OrderLineItem's side, you can only retrieve the variant of an order line item, and not the other way around.

Retrieve with Query#

To retrieve the variant of a line item with Query, pass variant.* in fields:

Note: To retrieve the product, pass product.* in fields.

Pricing Module#

The Product Module doesn't provide pricing-related features.

Instead, Medusa defines a link between the ProductVariant and the PriceSet data models. A product variant’s prices are stored belonging to a price set.

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

So, to add prices for a product variant, create a price set and add the prices to it.

Retrieve with Query#

To retrieve the price set of a variant with Query, pass price_set.* in fields:

To manage the price set of a variant, use Link:


Sales Channel Module#

The Sales Channel Module provides functionalities to manage multiple selling channels in your store.

Medusa defines a link between the Product and SalesChannel data models. A product can have different availability in different sales channels.

A diagram showcasing an example of how data models from the Product and Sales Channel modules are linked.

Retrieve with Query#

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

To manage the sales channels of a product, use Link:


Translation Module#

Medusa defines read-only links from several data models in the Product Module to the Translation data model in the Translation Module:

  • Product (one-to-many) to Translation, and vice versa.
  • ProductVariant (one-to-many) to Translation. You can only retrieve the translations of a product variant, and not the other way around.
  • ProductCategory (one-to-many) to Translation. You can only retrieve the translations of a product category, and not the other way around.
  • ProductCollection (one-to-many) to Translation. You can only retrieve the translations of a product collection, and not the other way around.
  • ProductTag (one-to-many) to Translation. You can only retrieve the translations of a product tag, and not the other way around.
  • ProductType (one-to-many) to Translation. You can only retrieve the translations of a product type, and not the other way around.
  • ProductOption (one-to-many) to Translation. You can only retrieve the translations of a product option, and not the other way around.
  • ProductOptionValue (one-to-many) to Translation. You can only retrieve the translations of a product option value, and not the other way around.

Retrieve with Query#

To retrieve the translations of a product with Query, pass translations.* in fields:

Note: You can pass the translations.* field when querying any of the above-mentioned data models to retrieve their associated translations.
Was this page helpful?
Ask Bloom
For assistance in your development, use Claude Code Plugins or Docs MCP server in Cursor, VSCode, etc...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
⇧↵