📥 Retrieving a Wishlist
This guide explains how to retrieve wishlists and optionally include their items in the response.
✅ Plugin Config to include Wishlisted Items
To automatically include wishlist items in the response when retrieving or listing wishlists, your plugin must be configured with:
{
resolve: "@alphabite/medusa-wishlist",
options: {
includeWishlistItems: true,
includeWishlistItemsTake: 5 // optional, default value is 5
}
}
includeWishlistItemsTake option is optional, by default if includeWishlistItems is set to true, it will return up to 5 items, if you want more or less add the includeWishlistItemsTake option and set the desired amount
📘 Behavior
When includeWishlistItems is set to true:
- GET /store/wishlists/:id returns the wishlist and up to
Nitems - GET /store/wishlists returns all wishlists, each with up to
Nitems
Where N is the value of includeWishlistItemsTake (default: 5)
🔍 Retrieve a Single Wishlist
- Using SDK
- Using REST (Medusa SDK or fetch)
const retrievedWishlist = await sdk.alphabite.wishlist.retrieve({
id: "wl_...",
});
import { RetrieveWishlistInput, RetrieveWishlistOutput } from "@alphabite/medusa-sdk";
const retrievedWishlist = await sdk.client.fetch<RetrieveWishlistOutput>(`/store/wishlists/${wishlistId}`, {
method: "GET",
query: {
items_fields: [],
} as Omit<RetrieveWishlistInput, "id">,
});
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper 🔗
You can view the full endpoint documentation for Retrieve a Wishlist
🔍 List Wishlists
- Using SDK
- Using REST (Medusa SDK or fetch)
const retrievedWishlist = await sdk.alphabite.wishlist.list({});
import { RetrieveWishlistInput, RetrieveWishlistsOutput } from "@alphabite/medusa-sdk";
const retrievedWishlist = await sdk.client.fetch<RetrieveWishlistsOutput>(`/store/wishlists`, {
method: "GET",
query: {} as RetrieveWishlistsInput,
});
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper 🔗
You can view the full endpoint documentation for Retrieve a Wishlist
📝 Notes
- If
includeWishlistItemsis not enabled, theitemsfield will not be included at all - This behavior affects both single retrieval and list endpoints
- To get the full list of items beyond the
includeWishlistItemsTakelimit, call: