Wishlist
Let guests and users set up wishlists
π§ββοΈ Wishlist Plugin for Medusa
The Alphabite Wishlist Plugin is the most feature-complete wishlist system for MedusaJS. It supports both authenticated and guest users, multiple wishlists per user, and a full-featured SDK client for frontend integration.
This plugin ships with:
- π A fully typed JS SDK plugin
- π A Postman collection
- β Support for guest & authenticated customers
π Table of Contents
- β¨ Features
- π¦ Installation
- π§ Plugin Options
- π¦ API Endpoints
- π§βπ» SDK Usage
- π§ͺ Guest Wishlist Flow
- π§© Requirements
- π Postman Collection
- π€ Contributing
β¨ Features
- β Multiple wishlists per customer
- β Add/remove items to/from any wishlist
- β Guest wishlist supported + transfer when registered
- β Fully typed Medusa JS SDK integration with our SDK client
- β Pagination and filtering built-in
π¦ Installation
Install the plugin via npm:
1npm install @alphabite/medusa-wishlist
In your Copy to clipboardmedusa-config.js
, register the plugin:
12345678910111213const plugins = [{resolve: '@alphabite/medusa-wishlist',options: {// all are optional, read bellow about default valueswishlistFields: [],wishlistItemsFields: [],includeWishlistItems: true,includeWishlistItemsTake: 5,allowGuestWishlist: true,},},]
π§ Plugin Options
Option Type Default Description Copy to clipboardwishlistFields
Copy to clipboardstring[]
Copy to clipboard["items.*", "items.product_variant.*", "items.product_variant.prices.*", "items.product_variant.product.thumbnail", "items.product_variant.product.id"]
Selectively include Medusa product or product variant fields on wishlist list/retrieve endpoints that have wishlist items included Copy to clipboardwishlistItemsFields
Copy to clipboardstring[]
Copy to clipboard["id", "product_id", "wishlist_id", "created_at", "wishlist.customer_id", "updated_at", "deleted_at", "product_variant.*", "product_variant.prices.*", "product_variant.calculated_price", "product_variant.product.thumbnail",]
Selectively include Medusa product or product variant fields on wishlist items list/retrieve endpoints Copy to clipboardincludeWishlistItems
Copy to clipboardboolean
Copy to clipboardfalse
Automatically populate wishlist items in Copy to clipboardGET /store/wishlists
Copy to clipboardincludeWishlistItemsTake
Copy to clipboardnumber
Copy to clipboard5
Limit number of items if Copy to clipboardincludeWishlistItems
is true Copy to clipboardallowGuestWishlist
Copy to clipboardboolean
Copy to clipboardfalse
Enables wishlist creation & usage without authentication (cookie-based)
π¦ API Endpoints
All endpoints are available under Copy to clipboard/store/wishlists
.
Method Endpoint Auth Description GET Copy to clipboard/store/wishlists
β
List wishlists for the current customer POST Copy to clipboard/store/wishlists
β (optional) Create a new wishlist GET Copy to clipboard/store/wishlists/:id
β (optional) Retrieve a wishlist by ID PUT Copy to clipboard/store/wishlists/:id
β
Update wishlist metadata DELETE Copy to clipboard/store/wishlists/:id
β
Delete a wishlist POST Copy to clipboard/store/wishlists/:id/transfer
β
Transfer guest wishlist to logged-in user GET Copy to clipboard/store/wishlists/:id/items
β (optional) Get items in a wishlist POST Copy to clipboard/store/wishlists/:id/add-item
β (optional) Add an item to the wishlist DELETE Copy to clipboard/store/wishlists/:id/items/:item_id
β (optional) Remove an item from the wishlist
π§βπ» SDK Usage
βββRead more about our Medusa compatible SDK here
1234567891011121314151617181920import { AlphabiteMedusaClient, wishlistPlugin } from '@alphabite/sdk'const sdk = new AlphabiteMedusaClient({{baseUrl,debug: process.env.NODE_ENV === "development",publishableKey: process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY,},[wishlistPlugin],{getAuthHeader: () => { return { authorization: `Bearer ${customerJwt}` } },}})// Create wishlistawait sdk.alphabite.wishlist.create({ name: 'My Sneakers' })// Add itemawait sdk.alphabite.wishlist.addItem({id: 'wishlist_id',
π§ͺ Guest Wishlist Flow
Guest wishlists work like guest carts:
- Create a wishlist (no auth required)
- Save the Copy to clipboard
id
in a cookie - Use that ID for listing/adding/removing items
- When the user signs up or logs in, call the Copy to clipboard
transfer
endpoint to associate it:
1await medusa.alphabite.wishlist.transfer({ id: wishlistId })
After that, the cookie is no longer needed.
π§© Requirements
- Medusa v2.5.0+
- Works with both Copy to clipboard
@medusajs/types
and Copy to clipboard@medusajs/framework
π Postman Collection
Youβll find the ready-to-import Postman collection at:
1docs/postman/WishlistPlugin.postman_collection.json
Use it to explore and test all endpoints interactively.
π€ Contributing
We welcome issues, feedback, and PRs. Fork it, build it, improve it.
Letβs make commerce more personalized ποΈ