Links between Loyalty Module and Other Modules
This document showcases the module links defined between the Loyalty Module and other Commerce Modules.
Summary#
The Loyalty Module has the following links to other modules:
First Data Model | Second Data Model | Type | Description |
|---|---|---|---|
Cart in Cart Module |
| Stored - many-to-many | |
| Stored - many-to-many | ||
| Read-only | ||
|
| Stored - many-to-one |
Cart Module#
When a customer applies a gift card during checkout, Medusa defines a link between the Cart and GiftCard data models.
This allows you to retrieve the gift cards applied on a cart.
Retrieve with Query#
To retrieve the gift cards of a cart with Query, pass in :
Manage with Link#
To manage the gift cards of a cart, use Link:
Order Module#
Order and Gift Cards#
When a customer places an order that includes gift cards, Medusa defines a link between the Order and GiftCard data models.
This allows you to retrieve the gift cards applied on an order.
Retrieve with Query
To retrieve the gift cards of an order with Query, pass gift_cards.* in fields:
Manage with Link
To manage the gift cards of an order, use Link:
Gift Card and Order Line Item
Medusa defines a read-only link between the GiftCard data model and the Order Module's OrderLineItem data model. This means you can retrieve the order line item where the gift card was purchased, but you don't manage the links in a pivot table in the database. The line item of a gift card is determined by the line_item_id property of the GiftCard data model.
Retrieve with Query
To retrieve the order line item of a gift card with Query, pass line_item.* in fields:
Store Credit Module#
Medusa defines a link between the GiftCard and StoreCreditAccount from the Store Credit Module. This link is created when a gift card is created (alongside its store credit account) or when a gift card is redeemed.
This allows you to retrieve the store credit account associated with a gift card.
Retrieve with Query#
To retrieve the store credit account of a gift card with Query, pass store_credit_account.* in fields:
Manage with Link#
To manage the store credit account of a gift card, use Link: