🕶️ Guest Wishlist & Transfer Guide
This guide explains how to implement guest wishlists in your storefront using the Alphabite Wishlist Plugin, and how to transfer them to a logged-in customer after authentication.
✅ Prerequisites
Enable guest wishlist support in your Medusa config:
{
resolve: "@alphabite/medusa-wishlist",
options: {
allowGuestWishlist: true,
}
}
🧠 Basic Flow
- Enable guest wishlist support
- Create a wishlist for the guest on page load
- Save the wishlist ID in cookie or localStorage
- Add items using that wishlist ID
- Transfer the wishlist after login/register
🔨 Step-by-Step Implementation
1. Create Wishlist on Page Load
If no wishlist ID is stored, create a new wishlist:
- Using SDK
- Using REST (Medusa SDK or fetch)
const createdWishlist = await sdk.alphabite.wishlist.create({
sales_channel_id: "sc_...",
name: "My Wishlist", //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: "My Wishlist", //optional
} as CreateWishlistInput,
});
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper 🔗
You can view the full endpoint documentation for Create Wishlist 🔗
2. Add Item to Wishlist
Use the stored wishlist ID when adding an item:
- 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,
});
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper 🔗
You can view the full endpoint documentation for Add Item to Wishlist
3. Transfer Wishlist After Login/Register
Once the user logs in or registers, transfer the wishlist to their customer account:
- Using SDK
- Using REST (Medusa SDK or fetch)
const transferredWishlist = await sdk.alphabite.wishlist.transfer({
id: "wl_...",
});
import { TransferWishlistInput, TransferWishlistOutput } from "@alphabite/medusa-sdk";
const transferredWishlist = await sdk.client.fetch<TransferWishlistOutput>("/store/wishlists/transfer", {
method: "POST",
body: {
id: "wl_...",
} as TransferWishlistInput,
});
Learn more about our Medusa SDK Wrapper Alphabite Medusa SDK Wrapper 🔗
You can view the full endpoint documentation for Transfer Wishlist
📝 Notes
- Storing the wishlist ID in localStorage is optional, but allows persistence across page reloads or visits.
- The transfer process replaces ownership of the wishlist — it is not merged.
- You can build this flow to mirror the Medusa cart behavior for a consistent UX.
🧠 Tip
You can wrap this logic into a custom hook like useGuestWishlist()
and use it across product pages or modals to handle guest wishlist state.
🔗 Related
- Docs: Alphabite Medusa SDK Wrapper
- Docs: Create Wishlist - POST /store/wishlists
- Docs: Add Item to Wishlist - POST /store/wishlists/:wishlist_id/items
- Docs: Transfer Wishlist - POST /store/wishlists