npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@petridhsg/medusa-plugin-wishlist

v1.0.0

Published

Customer product wishlist for Medusa v2. Adds a per-customer wishlist with store and admin API routes.

Readme

medusa-plugin-wishlist

Customer product wishlist for Medusa v2.

Adds a per-customer wishlist backed by a wishlist_item table with a unique constraint on (customer_id, product_id). Includes store routes for authenticated customers and admin routes for managing wishlists on behalf of any customer.


Features

  • Add and remove products from a wishlist
  • Unique constraint prevents duplicate entries
  • Store routes use Medusa's JWT auth — no custom auth logic needed
  • Admin routes let you view and manage any customer's wishlist
  • Fetches full product data (title, thumbnail, handle, status) via Medusa's query graph

Requirements

  • Medusa >=2.14.0
  • Node >=20
  • PostgreSQL

Installation

npm install @petridhsg/medusa-plugin-wishlist
# or
pnpm add @petridhsg/medusa-plugin-wishlist

Setup

1. Register in medusa-config.ts

Both entries are required: plugins loads the API routes; modules registers the database module.

import { defineConfig } from "@medusajs/framework/config"
import { WishlistModule } from "@petridhsg/medusa-plugin-wishlist"

export default defineConfig({
  plugins: [
    { resolve: "@petridhsg/medusa-plugin-wishlist" },
  ],

  modules: [
    { resolve: WishlistModule },
  ],
})

2. Run migrations

npx medusa db:migrate

Creates the wishlist_item table:

| Column | Type | Description | |---|---|---| | id | text | Primary key | | customer_id | text | Medusa customer ID | | product_id | text | Medusa product ID | | created_at | timestamptz | | | updated_at | timestamptz | | | deleted_at | timestamptz | Soft delete |

A partial unique index on (customer_id, product_id) WHERE deleted_at IS NULL prevents duplicate entries.


API Reference

Store Routes

Require a logged-in customer. Pass the Medusa JWT in the Authorization: Bearer <token> header.

GET /store/wishlist

Returns the authenticated customer's wishlist with full product details.

{
  "product_ids": ["prod_01", "prod_02"],
  "products": [
    { "id": "prod_01", "title": "...", "thumbnail": "...", "handle": "...", "status": "published" }
  ]
}

POST /store/wishlist

Add a product. Idempotent — adding an already-wishlisted product is a no-op.

{ "product_id": "prod_01" }

DELETE /store/wishlist/:product_id

Remove a product from the wishlist.


Admin Routes

Standard Medusa admin authentication.

GET /admin/customers/:id/wishlist

Returns a customer's wishlisted products.

POST /admin/customers/:id/wishlist

Add a product to a customer's wishlist.

{ "product_id": "prod_01" }

DELETE /admin/customers/:id/wishlist/:product_id

Remove a product from a customer's wishlist.


Storefront usage

const headers = { "Authorization": `Bearer ${token}`, "Content-Type": "application/json" }

// Fetch wishlist
const { products } = await fetch("/store/wishlist", { headers }).then(r => r.json())

// Add to wishlist
await fetch("/store/wishlist", {
  method: "POST",
  headers,
  body: JSON.stringify({ product_id: "prod_01" }),
})

// Remove from wishlist
await fetch("/store/wishlist/prod_01", { method: "DELETE", headers })

License

MIT