The production-ready Medusa DTC Starter is outRead the announcement
W

Wishlist

The plugin which provides wishlist functionality.

npm install @rsc-labs/medusa-wishlist
Category
Built by
Version
0.0.6
Last updated
1 year ago
Monthly downloads
Loading downloads

Medusa Wishlist

A wishlist plugin for Medusa v2 that allows customers to save products for later and share their wishlists with others.

Features

  • ๐Ÿ›๏ธ Customer Wishlists - Each customer gets their own wishlist, automatically created when they add their first item
  • โž• Add/Update Items - Customers can add products to their wishlist and update quantities
  • ๐Ÿ—‘๏ธ Remove Items - Easy removal of items from the wishlist
  • ๐Ÿ”— Share Wishlists - Generate shareable links using JWT tokens
  • ๐ŸŒ Public Access - Shared wishlists can be viewed without authentication
  • ๐Ÿ”’ Secure - JWT-based token system for sharing

Installation

Option 1: Install as NPM Package

  1. Install the plugin:
  1. Add the plugin to your :

Or simply:

  1. Run database migrations:
npx medusa db:migrate

Option 2: Copy Source Code

You can also copy the source code directly into your Medusa project:

  1. Copy the directory contents into your project
  2. Add the module to your :
  1. Install required dependencies:
  1. Run database migrations:
npx medusa db:migrate

Configuration

JWT Secret

The wishlist sharing feature uses JWT tokens. It's recommended to set a strong secret in your environment variables:

Then configure it in :

API Endpoints

Authenticated Endpoints (Require Customer Token)

Get Customer's Wishlist

Add or Update Item

Remove Item

Generate Share Token

Public Endpoints (No Authentication Required)

View Shared Wishlist

GET /store/wishlists?token={shared-token}

Usage Example

1. Customer Login

2. Add Item to Wishlist

3. Get Wishlist

4. Generate Share Token

5. View Shared Wishlist (Public)

Database Schema

The plugin creates the following tables:

  • - Primary key
  • - Timestamp
  • - Timestamp

  • - Primary key
  • - Foreign key to wishlist
  • - Product identifier
  • - Product variant identifier
  • - Item quantity
  • - Timestamp
  • - Timestamp
  • Links customers to their wishlists (1:1 relationship)

How It Works

  1. Automatic Creation: When a customer adds their first item, a wishlist is automatically created and linked to their account
  2. Item Management: Customers can add, update quantities, or remove items from their wishlist
  3. Sharing: Customers can generate a JWT token to share their wishlist with others
  4. Public Access: Anyone with the share token can view the wishlist without authentication

API Documentation

For detailed API specifications, see the OpenAPI documentation.

Development

Prerequisites

  • Node.js 20+
  • Medusa v2
  • PostgreSQL

Local Setup

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

MIT License - see LICENSE file for details.

Credits

Created by RSC Labs

Support

For issues and questions:


Built for Medusa v2 ๐Ÿš€