@stackd-solutions/medusa-wishlist
v0.1.6
Published
Wishlist plugin for Medusa
Downloads
70
Maintainers
Readme
A Medusa v2 plugin that adds wishlist functionality for customers. Customers can create, manage, and share wishlists of product variants. Supports public/private visibility and an admin widget showing wishlist counts per product.
Features
- Create, update, and delete wishlists
- Add and remove product variants from wishlists
- Multiple wishlists per customer
- Public/private wishlist visibility
- Admin widget showing wishlist count per product
- Pagination on all list endpoints
Installation
yarn add @stackd-solutions/medusa-wishlistConfiguration
Register the plugin and its module in your medusa-config.ts:
import {defineConfig} from '@medusajs/framework/utils'
export default defineConfig({
// ... other config
plugins: [
{
resolve: '@stackd-solutions/medusa-wishlist',
options: {}
}
],
modules: [
{
resolve: '@stackd-solutions/medusa-wishlist/modules/wishlist',
options: {}
}
]
})After adding the plugin, run migrations:
npx medusa db:migratePlugin Options
| Option | Type | Default | Description |
| ----------------------- | -------- | ------- | --------------------------------------------- |
| maxWishlistNameLength | number | 40 | Maximum characters allowed for wishlist names |
| defaultPageSize | number | 10 | Default number of items per page |
API Endpoints
| Method | Endpoint | Scope | Auth | Description |
| ------ |-------------------------------------------------------------| ----- | ---- |------------------------------------------|
| GET | /store/wishlists | Store | ✅ | List wishlists |
| POST | /store/wishlists | Store | ✅ | Create a new wishlist |
| GET | /store/wishlists/:id | Store | ⚠️ | Retrieve a wishlist by ID |
| PUT | /store/wishlists/:id | Store | ✅ | Update wishlist metadata and visibility |
| DELETE | /store/wishlists/:id | Store | ✅ | Delete a wishlist |
| GET | /store/wishlists/:id/items | Store | ⚠️ | Get items in a wishlist |
| POST | /store/wishlists/:id/items | Store | ✅ | Add an item to the wishlist |
| DELETE | /store/wishlists/:id/items/:product_variant_id | Store | ✅ | Remove an item from the wishlist |
| GET | /admin/products/:product_id/wishlist | Admin | ✅ | Get wishlist count for a product |
| GET | /admin/products/:product_id/variants/:variant_id/wishlist | Admin | ✅ | Get wishlist count for a product variant |
✅ = Requires authentication. ⚠️ = Public wishlists can be accessed without authentication.
Filtering Wishlists
The GET /store/wishlists endpoint supports the following query parameters for filtering:
| Parameter | Type | Description |
| -------------------- | -------- | -------------------------------------------------- |
| name | string | Filter by wishlist name |
| sales_channel_id | string | Filter by sales channel |
| visibility | string | Filter by visibility (private or public) |
| product_variant_id | string | Filter wishlists containing a specific variant |
Example: GET /store/wishlists?product_variant_id=variant_123 returns only wishlists that contain that variant.
Filtering Wishlist Items
The GET /store/wishlists/:id/items endpoint supports the following query parameters for filtering:
| Parameter | Type | Description |
| -------------------- | -------- | ---------------------------------------------- |
| product_variant_id | string | Filter items by a specific product variant |
Example: GET /store/wishlists/wl_123/items?product_variant_id=variant_123&limit=1 checks if a variant exists in the wishlist.
Admin Widgets
Product Widget
Adds a widget to the product detail page (product.details.before) showing how many wishlists contain the product across all variants.
Variant Widget
Adds a widget to the product variant detail page (product_variant.details.before) showing how many wishlists contain that specific variant.
Build
yarn buildDevelopment
yarn devTypes
import type {
Wishlist,
WishlistItem,
WishlistVisibility,
WishlistListResponse,
WishlistResponse,
WishlistItemsResponse,
WishlistItemResponse,
DeleteResponse,
PaginationMetadata,
CreateWishlistRequest,
UpdateWishlistRequest,
AddWishlistItemRequest,
ProductWishlistCountResponse,
WishlistPluginOptions
} from '@stackd-solutions/medusa-wishlist'The module key is also exported:
import {WISHLIST_MODULE} from '@stackd-solutions/medusa-wishlist'License
Apache 2.0
