Skip to main content

Links between Wishlist Module and Other Modules

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

Summary

The Wishlist Module has the following links to other modules:
First Data ModelSecond Data ModelTypeDescription
CustomerWishlistStored - one-to-oneAssociates a customer with their wishlist
WishlistProductStored - one-to-manyAssociates wishlist items with products

Customer Module

Mercur defines a link between the Customer Module’s Customer data model and the Wishlist Module’s Wishlist data model. This allows each customer to have a wishlist for saving products they’re interested in.

Retrieve with Query

To retrieve the wishlist of a customer with Query, pass wishlist.* in fields:
const { data: customers } = await query.graph({
  entity: "customer",
  fields: [
    "*",
    "wishlist.*",
  ],
})

// customers[0].wishlist
To manage the wishlist of a customer, use Link:

Product Module

Mercur defines a link between the Wishlist Module’s Wishlist data model and the Product Module’s Product data model. This allows wishlist items to reference specific products that customers want to save for later.

Retrieve with Query

To retrieve the products in a wishlist with Query, pass product.* in fields:
const { data: wishlists } = await query.graph({
  entity: "wishlist",
  fields: [
    "*",
    "product.*",
  ],
})

// wishlists[0].product
To manage the products in a wishlist, use Link:
Both links have deleteCascade enabled, meaning when a customer is deleted, their wishlist and all wishlist items are automatically deleted.