Skip to content

Latest commit

 

History

History
102 lines (72 loc) · 2.19 KB

File metadata and controls

102 lines (72 loc) · 2.19 KB

Medusa v2 Example: Customer Tiers

This directory holds the code for the Customer Tiers Tutorial.

You can either:

Prerequisites

Installation

  1. Clone the repository and change to the customer-tiers directory:
git clone https://github.com/medusajs/examples.git
cd examples/customer-tiers

2. Rename the .env.template file to .env.

3. If necessary, change the PostgreSQL username, password, and host in the DATABASE_URL environment variable.

4. Install dependencies:

yarn # or npm install

5. Setup and seed the database:

npx medusa db:setup
yarn seed # or npm run seed

6. Start the Medusa application:

yarn dev # or npm run dev

You'll find a "Customer Tiers" item in the sidebar of the Medusa Admin where you can manage the customer tiers.

Copy into Existing Medusa Application

If you have an existing Medusa application, copy the following directories and files into your project:

  • src/admin
  • src/api
  • src/links
  • src/modules/tier
  • src/subscribers
  • src/workflows

Then, add the Tier Module to medusa-config.ts:

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "./src/modules/tier",
    }
  ],
})

After that, install the Index Module

yarn add @medusajs/index # or npm install @medusajs/index

And add it to medusa-config.ts:

module.exports = defineConfig({
  // ...
  modules: [
    {
      resolve: "@medusajs/index",
    }
  ],
})

Finally, run migrations:

npx medusa db:migrate

More Resources