• Сообщество
  • Блог
Документация
Плагины и интеграцииВсе расширения для Medusa от сообществаЭкспертыПодберите специалиста для разработки и развития вашего проекта на Medusa
КейсыПосмотрите примеры Medusa в продакшене и успешные внедрения
Меч Moscow
Комплексная e-commerce платформа на Medusa для московского fashion-бренда

Меч Moscow · Fashion

Gorgo снижает затраты на адаптацию Medusa к локальным рынкам.

Мы разрабатываем плагины интеграции, осуществляем поддержку и развиваем сообщество разработчиков на Medusa в Telegram.

  • Ресурсы Medusa
  • Плагины и интеграции
  • Эксперты
  • Кейсы
  • Medusa Чат в Telegram
  • Medusa Новости в Telegram
  • Документация Gorgo
  • Связаться с нами
  • TelegramGitHub
Плагины
P

Product description

Medusa v2 plugin to generate AI-powered product descriptions via OpenRouter.

npm install medusa-plugin-product-description
Категория
Другое
Создано
Juansoler
Версия
1.0.2
Последнее обновление
2 месяца назад
Ежемесячные загрузки
Загрузка данных
Звезды на Github
0
npmNPM

medusa-plugin-product-description

AI-powered product & category description generator plugin for MedusaJS v2.

This plugin uses AI (via OpenRouter) to generate SEO-optimized descriptions for products and categories in Spanish. It adds widgets on the product and category detail pages, plus a dedicated admin page for batch operations and cache management.

Features

  • Product detail widget: "Generar Descripcion con IA" button directly on the product edit page
  • Category detail widget: "Generar Descripcion de Categoria con IA" button directly on the category edit page
  • Admin page "IA Descripciones": individual generation for products and categories, batch generation of ALL products/categories, and cache revalidation
  • AI generation via OpenRouter (OpenAI-compatible API, supports any model: Google Gemini, GPT, Claude, etc.)
  • Configurable prompts via environment variables
  • Automatic date stamp: "Descripcion actualizada el DD/MM/AAAA"
  • Server-side cache revalidation via
  • Batch operations with progress bar and cost warning
  • Zero hardcoded URLs — works on any Medusa installation

Prerequisites

  • MedusaJS v2.13.0 or later
  • Node.js v20 or later
  • An OpenRouter API key (free tier available)

Installation

npm install medusa-plugin-product-description

Configuration

1. Environment Variables

Add the following to your Medusa project's file:

1OPENROUTER_API_KEY=sk-or-v1-your-key-here
2OPENROUTER_MODEL=google/gemma-3-12b-it:free
3OPENROUTER_SITE_URL=https://your-store.com
4OPENROUTER_APP_NAME=Your Store Admin
5STOREFRONT_URL=https://your-storefront.com
6AI_DESCRIPTION_PROMPT=Genera una descripcion atractiva, natural y optimizada para SEO sobre el producto "{productTitle}". ...
7AI_CATEGORY_PROMPT=Escribe una descripcion breve, natural y optimizada para SEO en Markdown sobre la categoria **{categoryName}**. ...
VariableRequiredDefaultDescription
Yes—OpenRouter API key (sign up at openrouter.ai)
NoModel to use. Browse models
No—Your site URL (sent as header)
NoYour app name (sent as header)
No—Your storefront base URL for cache revalidation (e.g. )
NoDefault prompt (see below)Prompt template for products. Use as placeholder
NoDefault prompt (see below)Prompt template for categories. Use as placeholder

Default product prompt:

Default category prompt:

2. Medusa Configuration

In your , register the plugin:

1import { defineConfig } from "@medusajs/framework/config"
2
3export default defineConfig({
4 plugins: [
5 {
6 resolve: "medusa-plugin-product-description",
7 options: {},
8 },
9 ],
10})

Usage

Widgets (recommended)

The plugin injects widgets directly into the Medusa admin:

  • Product detail page (): A "Generar Descripcion con IA" section appears below the product details. Generate, edit, save, and revalidate — all without leaving the page.
  • Category detail page (): Same widget for categories, with sibling category context for better AI results.

Admin Page: IA Descripciones

Navigate to IA Descripciones in the sidebar for advanced operations:

Individual generation:

  • Enter a product or category ID, load it, generate a description, edit and save.

Batch generation:

  • Generate descriptions for ALL products or ALL categories in one go.
  • A progress bar shows real-time status.
  • ⚠️ Warning: This calls the OpenRouter API for every entity. Use with caution — it may consume significant API credits.

Cache management:

  • Revalidate products cache, categories cache, or both at once.
  • Requires environment variable pointing to your storefront.

Next.js Revalidation Endpoint

If you're using a Next.js storefront, this plugin calls to revalidate the ISR cache. Add this endpoint:

1// frontend/src/app/api/revalidate/route.ts
2import { revalidateTag } from "next/cache"
3import { NextRequest, NextResponse } from "next/server"
4
5export async function GET(request: NextRequest) {
6 const tag = request.nextUrl.searchParams.get("tags") || "products"
7 revalidateTag(tag)
8 return NextResponse.json({ revalidated: true, tag })
9}

API Endpoints

Generate a product description.

Request:

{ "productId": "prod_01JABC...", "productTitle": "Paracetamol 650mg" }

Response:

{ "description": "## Paracetamol 650mg\n\nAlivia el dolor y la fiebre con..." }

Generate a category description. Optionally include sibling category names for context.

Request:

1{
2 "categoryId": "pcat_01JABC...",
3 "categoryName": "Analgesicos",
4 "relatedCategories": ["Antiinflamatorios", "Antigripales"]
5}

Response:

{ "description": "## Analgesicos\n\nEncuentra los mejores analgesicos..." }

Trigger cache revalidation on the storefront. Requires environment variable.

Request:

{ "tags": "products" }

Response:

{ "revalidated": true, "tags": "products" }

Development

1# Install dependencies
2npm install
3
4# Build the plugin
5npm run build
6
7# Watch mode (for local plugin development)
8npm run dev

Local Testing with a Medusa Project

1# From your plugin directory
2npm run dev
3
4# In your Medusa project directory:
5npx medusa plugin:add ../path-to/medusa-plugin-product-description

Publishing to NPM

1npx medusa plugin:build
2npm publish

To publish an update:

1npm version patch # or minor / major
2npx medusa plugin:build
3npm publish

License

MIT

Еще в этой категории

Посмотреть все
Другое
Gati logo

Gati

От Devx Commerce

Синхронизируйте Medusa с Gati ERP

Загрузка данных
npm
Другое
Product Reviews logo

Product Reviews

От Lambda Curry

Добавляйте рейтинги, отзывы и модерацию товаров

Загрузка данных
GitHubnpm
Другое
Variant Images logo

Variant Images

От Betanoir

Организуйте и загружайте варианты изображений в Medusa

Загрузка данных
GitHubnpm

Еще от этого автора

Посмотреть все
Платежи
R

Redsys

От Juansoler

Redsys / Sermepa TPV Virtual payment provider plugin for MedusaJS v2

Загрузка данных
GitHubnpm