@alphabite/medusa-wishlist

中文文档
0.7.6发布于 2026/10/18MITTypeScriptESM + CJS零依赖近 30 天下载 4596

Alphabite's Medusa Wishlist Plugin

原始使用文档
文档目录15 节
  1. ⚠️ Version Compatibility
  2. Installing the latest version (Medusa 2.14.* and above)
  3. Installing version 0.5.8 (Medusa 2.13.*)
  4. Installing version 0.5.7 (Medusa versions below 2.13.0)
  5. 📚 Table of Contents
  6. ✨ Features
  7. 📦 Installation
  8. 🔧 Plugin Options
  9. 🛠️ Admin
  10. 📦 API Endpoints
  11. 🧑‍💻 SDK Usage
  12. 🧪 Guest Wishlist Flow
  13. 🧩 Requirements
  14. 📭 Postman Collection
  15. 🤝 Contributing

🧞‍♂️ 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

⚠️ Version Compatibility

Please install the plugin version that matches your Medusa version:

Medusa VersionPlugin VersionInstall Command
2.14.* and abovelatestnpm install @alphabite/medusa-wishlist
2.13.*0.5.8npm install @alphabite/[email protected]
Below 2.13.00.5.7npm install @alphabite/[email protected]

latest is built and tested against Medusa 2.21.0.

Installing the latest version (Medusa 2.14.* and above)

npm install @alphabite/medusa-wishlist

Installing version 0.5.8 (Medusa 2.13.*)

npm install @alphabite/[email protected]

Installing version 0.5.7 (Medusa versions below 2.13.0)

npm install @alphabite/[email protected]

ℹ️ Using a mismatched version may result in compatibility issues. Make sure to check your Medusa version (npm list @medusajs/medusa) before installing.


📚 Table of Contents


✨ 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
  • ✅ Admin page with Settings + Analytics tabs

📦 Installation

Install the plugin via npm:

npm install @alphabite/medusa-wishlist

In your medusa-config.js, register the plugin:

const plugins = [
  {
    resolve: "@alphabite/medusa-wishlist",
    options: {
      // all are optional, read bellow about default values
      wishlistFields: [],
      wishlistItemsFields: [],
      includeWishlistItems: true,
      includeWishlistItemsTake: 5,
      allowGuestWishlist: true,
    },
  },
];

🔧 Plugin Options

OptionTypeDefaultDescription
wishlistFieldsstring[]["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
wishlistItemsFieldsstring[]["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
includeWishlistItemsbooleanfalseAutomatically populate wishlist items in GET /store/wishlists
includeWishlistItemsTakenumber5Limit number of items if includeWishlistItems is true
allowGuestWishlistbooleanfalseEnables wishlist creation & usage without authentication (cookie-based)

🛠️ Admin

The plugin adds a Wishlists page to the admin sidebar (/app/wishlists) with two tabs: Settings (guest / multiple-wishlist toggles) and Analytics (a read-only dashboard of KPIs, an activity trend, and the most-wishlisted products and variants).

See docs/admin-analytics.md for the analytics endpoint and response shape.


📦 API Endpoints

All endpoints are available under /store/wishlists.

MethodEndpointAuthDescription
GET/store/wishlists✅List wishlists for the current customer
POST/store/wishlists➖ (optional)Create a new wishlist
GET/store/wishlists/:id➖ (optional)Retrieve a wishlist by ID
PUT/store/wishlists/:id✅Update wishlist metadata
DELETE/store/wishlists/:id✅Delete a wishlist
POST/store/wishlists/:id/transfer✅Transfer guest wishlist to logged-in user
GET/store/wishlists/:id/items➖ (optional)Get items in a wishlist
POST/store/wishlists/:id/add-item➖ (optional)Add an item to the wishlist
DELETE/store/wishlists/:id/items/:item_id➖ (optional)Remove an item from the wishlist

🧑‍💻 SDK Usage

❗❗❗Read more about our Medusa compatible SDK here

import { 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 wishlist
await sdk.alphabite.wishlist.create({ name: 'My Sneakers' })

// Add item
await sdk.alphabite.wishlist.addItem({
  id: 'wishlist_id',
  product_variant_id: 'variant_id',
})

// List items
const { data } = await sdk.alphabite.wishlist.listItems({ id: 'wishlist_id' })

🧪 Guest Wishlist Flow

Guest wishlists work like guest carts:

  1. Create a wishlist (no auth required)
  2. Save the id in a cookie
  3. Use that ID for listing/adding/removing items
  4. When the user signs up or logs in, call the transfer endpoint to associate it:
await medusa.alphabite.wishlist.transfer({ id: wishlistId });

After that, the cookie is no longer needed.


🧩 Requirements

  • Medusa v2.14.0+
  • Works with both @medusajs/types and @medusajs/framework

@mikro-orm/*, awilix and pg are provided by Medusa and don't need to be installed alongside the plugin.


📭 Postman Collection

You’ll find the ready-to-import Postman collection at:

alphabite-wishlist-postman.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 🛍️

版本与发布记录

@alphabite/medusa-wishlist 共发布 41 个版本,首次发布于 2025/06/10;过去 12 个月发布了 18 个版本。

版本发布日期距今
0.7.6latest2026/10/1820 天前
0.7.42026/06/055 个月前
0.7.32026/06/045 个月前
0.7.22026/06/035 个月前
0.7.12026/06/025 个月前
0.7.02026/06/025 个月前

关于 @alphabite/medusa-wishlist 的常见问题

@alphabite/medusa-wishlist 是什么?

Alphabite's Medusa Wishlist Plugin

如何安装 @alphabite/medusa-wishlist?

在项目目录运行 npm install @alphabite/medusa-wishlist,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@medusajs/ui(^4.0.4)、@medusajs/cli(^2.13.6)、@medusajs/icons(^2.13.6)、@medusajs/medusa(^2.13.6)、@medusajs/admin-sdk(^2.13.6)、@medusajs/framework(^2.13.6)、@medusajs/test-utils(^2.13.6)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@alphabite/medusa-wishlist 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@alphabite/medusa-wishlist 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@alphabite/medusa-wishlist 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=20。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@alphabite/medusa-wishlist 可以商用吗?

@alphabite/medusa-wishlist 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@alphabite/medusa-wishlist 的下载量有多少?

根据 npm 官方下载统计,@alphabite/medusa-wishlist 在 2026/10/06 – 2026/11/04 这 30 天内被下载 4,596 次,日均约 153 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@alphabite/medusa-wishlist 还在维护吗?

最新版本 0.7.6 发布于 2026/10/18(20 天前);至今共发布 41 个版本,其中过去 12 个月发布了 18 个;首次发布于 2025/06/10。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。