Links between Promotion Module and Other Modules

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

Summary#

The Promotion 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.

Cart Module#

A promotion can be applied on line items and shipping methods of a cart. Medusa defines a link between the Cart and Promotion data models.

A diagram showcasing an example of how data models from the Cart and Promotion modules are linked

Medusa also defines a read-only link between the Promotion data model and the Cart Module's LineItemAdjustment data model. This means you can retrieve the details of the promotion applied on a line item, but you don't manage the links in a pivot table in the database. The promotion of a line item is determined by the promotion_id property of the LineItemAdjustment data model.

Retrieve with Query#

To retrieve the carts that a promotion is applied on with Query, pass carts.* in fields:

NoteTo retrieve the line item adjustments of a promotion, pass line_item_adjustments.* in fields.

To manage the promotions of a cart, use Link:


Order Module#

An order is associated with the promotion applied on it. Medusa defines a link between the Order and Promotion data models.

A diagram showcasing an example of how data models from the Order and Promotion modules are linked

Retrieve with Query#

To retrieve the orders a promotion is applied on with Query, pass orders.* in fields:

To manage the promotion of an order, use Link:

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