Вышел Модуль интеграций 2.0 для MedusaЧитать анонс
С

Связанные товары

Кросс-продажи и допродажи для Medusa 2. Подобранные вручную упорядоченные списки товаров для каждого товара, виджет в Admin и Store API.

npm install @topo-js/medusa-plugin-product-relations
Создано
Topo-js
Версия
1.0.0
Ежемесячные загрузки
Загрузка данных
Последнее обновление

Индекс качества

3/4
  • Безопасность, Пройдено5/5
    • Нет скриптов установки, Пройдено
    • Нет известных уязвимостей, Пройдено
    • Нет сообщений о вредоносном коде, Пройдено
    • Нет секретов в пакете, Пройдено
    • Нет обфускации, Пройдено
  • Совместимость, Не проверено1/5 · не проверено: 4
    • Диапазоны версий Medusa, Пройдено
    • Чистая установкаНе проверено
    • СборкаНе проверено
    • МиграцииНе проверено
    • ЗапускНе проверено
    • Мы ещё не устанавливали этот плагин в тестовый проект Medusa.
  • Сопровождение, Пройдено5/5
    • Публичный репозиторий, Пройдено
    • Свежий релиз, Пройдено
    • Нет отставания от Medusa, Пройдено
    • Тесты в CI, Пройдено
    • Открытая лицензия, Пройдено
  • Документация, Пройдено3/3
    • Инструкция по установке, Пройдено
    • Английский язык, Пройдено
    • Переменные окружения, Пройдено

Версия 1.0.0 проверена на Medusa 2.23.1 (29 нояб. 2026 г.). Как Gorgo проверяет плагины →

Зрелость

Новый

Первый стабильный релиз 29 нояб. 2026 г., 1 версия, релизы в 1 из последних 12 месяцев. Как Gorgo оценивает зрелость →

@topo-js/medusa-plugin-product-relations

Cross-sells and upsells for Medusa 2.23+: hand-picked, ordered product lists per product, edited on the admin product page and served by store routes that return products priced and shaped like core's .

  • Cross sell: products that go with this one ("Complete your purchase").
  • Upsell: step-up versions or better alternatives ("Upgrade your choice").

Install

npx medusa db:migrate

Data model

Module . Tables are prefixed with so they never clash with your own.

(): one per product and type, unique on .

FieldTypeNotes
textthe product whose page shows the list
|
text, nullable, translatablenull lets the storefront show its own default
text, nullable, translatable
JSON, nullable

(): a product of a list.

FieldTypeNotes
text through a read-only link
text, nullableset: only that variant is offered
numberorder in the list, from 0
JSON, nullable

A deleted product loses its lists and leaves every other product's lists (subscriber on ).

Store API

Both routes take the same query params as core's (, , , ) and run the same middlewares, so products come with , tax amounts and exactly as there, and accept the same (for example ). A signed-in customer gets their customer group prices.

A product is suggested only if it is published, sold in the publishable key's sales channel, has a price (when prices are requested), has stock or allows backorders, is not the product itself or already in the cart, and was not suggested earlier in the same response.

RouteQueryResponse
(one or both, default both), (products in total),
(default ),

is for the product page: cross sell then upsell, each with its and (in the request locale). A list with nothing to sell is left out, so an empty array means "render nothing". With , prices use the cart and its products are never suggested.

is for the cart page and the panel after an add to cart: the cross sells of the cart's products, in cart order, without the products already in it. An unknown or completed cart is a 404.

Admin API

RouteDescription
: the product's lists, each with its in order and their
Saves one list:

replaces the list's products (the array order is the rank); , and left out keep their value, or an empty text clears them. (cross sell only) also adds this product to the end of each related product's cross sells, unless it is already there. It fails with a 400, writing nothing, on a product related to itself, a product listed twice, an unknown product or a variant of another product.

Admin

On the product page (), one section per list, Cross sell then Upsell, with the list's title (or "Storefront default"), description and products in order (draft products and variant-only relations are flagged). Each section's menu has:

  • Edit title and description: a drawer with from , validated with Zod. The title and description are translatable in Settings > Translations.
  • Edit products: a focus modal with the dashboard's product table (search, pagination, checkboxes) and the selected products beside it, reordered by dragging (mouse or keyboard). On cross sells, a switch also adds this product to the selected products' cross sells ().

UI texts in English and Spanish (), keys under .

Workflows

Exported from . Each step compensates on failure.

WorkflowHookHook input

Extend

Add your own data the way Medusa extends products: validate on and save it in the workflow hook.

Development

The integration tests boot a bare Medusa app () that loads the plugin from its build, so run first. They create their own database with , , and (default on ).

To try it in a Medusa app while developing, use here and in the app, then here to rebuild on change.

Release

The workflow publishes with npm Trusted Publishing, no token: the package's settings on npmjs.com trust this repository and .

License

MIT