๐งบ Supporting Multiple Wishlists
The Wishlist Plugin supports multiple wishlists per customer out of the box. This enables richer customer experiences and advanced personalization features.
๐ก Why Use Multiple Wishlists?โ
Here are a few common use cases:
- ๐ "Buy Later" list โ A wishlist for items the customer is thinking about
- ๐ Gift registry โ For weddings, birthdays, or other events
- ๐งข Style collections โ Curated items by category (e.g. "Winter Gear", "Sneakers", "Accessories")
- ๐ Private vs Public โ One wishlist for sharing, another for personal planning
โ๏ธ Creating Multiple Wishlistsโ
To create a wishlist, simply call the POST /store/wishlists
endpoint multiple times.
You can store multiple wishlist IDs per customer and show a selector/dropdown in the UI.
- Using SDK
- Using REST (Medusa SDK or fetch)
const createdWishlist = await sdk.alphabite.wishlist.create({
sales_channel_id: "sc_...",
name: "Optional name", // optional
});
import { CreateWishlistInput, CreateWishlistOutput } from "@alphabite/medusa-sdk";
const createdWishlist = await sdk.client.fetch<CreateWishlistOutput>(`/store/wishlists`, {
method: "POST",
body: {
sales_channel_id: "sc_...",
name: "Optional name", // optional
} as CreateWishlistInput,
});
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper ๐
You can view the full endpoint documentation for Create a Wishlist ๐
๐ Listing Wishlistsโ
To show the user all their saved 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 List Wishlists ๐
โ Adding Items to a Specific Wishlistโ
Every addItem
operation requires a wishlist ID.
- Using SDK
- Using REST (Medusa SDK or fetch)
const addedWishlistItem = await sdk.alphabite.wishlist.addItem({
id: "wl_...",
product_variant_id: "variant_...",
});
import { AddItemToWishlistInput, AddItemToWishlistOutput } from "@alphabite/medusa-sdk";
const addedWishlistItem = await sdk.client.fetch<AddItemToWishlistOutput>("/store/wishlists/:wishlist_id/items", {
method: "POST",
body: {
id: "wl_...",
product_variant_id: "variant_...",
} as AddItemToWishlistInput,
});
This lets users add products to specific lists from dropdowns or modal selectors.
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper ๐
You can view the full endpoint documentation for Add Item to Wishlist ๐
๐ Renaming or Updatingโ
You can rename any wishlist using:
- Using SDK
- Using REST (Medusa SDK or fetch)
const updatedWishlist = await sdk.alphabite.wishlist.update({
id: "wl_...",
name: "New Name", // optional
});
import { UpdateWishlistInput, UpdateWishlistsOutput } from "@alphabite/medusa-sdk";
const updatedWishlist = await sdk.client.fetch<UpdateWishlistsOutput>(`/store/wishlists/${wishlistId}`, {
method: "PUT",
body: {
name: "New Name", // optional
} as UpdateWishlistsInput,
});
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper ๐
You can view the full endpoint documentation for Update a Wishlist ๐
๐ข Total Items Across All Wishlistsโ
To power a UI counter (like a wishlist badge in the header), call the total-items-count
endpoint.
- Using SDK
- Using REST (Medusa SDK or fetch)
const updatedWishlist = await sdk.alphabite.wishlist.totalItemsCount({
id: "wl_...", // optional, to get count for a specific wishlist, omit for all wishlists items count
});
import { TotalItemsCountInput, TotalItemsCountsOutput } from "@alphabite/medusa-sdk";
const { totalItemsCount } = await sdk.client.fetch<TotalItemsCountsOutput>(`/store/wishlists/total-items-count`, {
method: "PUT",
body: {
id: "wl_...", // optional, to get count for a specific wishlist, omit for all wishlists items count
} as TotalItemsCountsInput,
});
This works with both guest and customer wishlists.
๐ก If you support multiple wishlists, this is the preferred way to get an accurate item count.