Skip to main content

Overview

The Product Module manages products and their associated data including variants, options, collections, categories, tags, and types. It provides a flexible catalog system that supports complex product hierarchies and customization. Key Features:
  • Product and variant management with options
  • Product collections and categories (tree structure)
  • Product images with variant-specific associations
  • Product tags and types for organization
  • Multi-language support with translations
  • Handle-based URLs for SEO

When to Use

Use the Product Module when you need to:
  • Create and manage product catalogs
  • Organize products with collections and categories
  • Handle product variants with multiple options (size, color, etc.)
  • Manage product images and metadata
  • Support multi-language product content
  • Track product status (draft, published, rejected)

Data Models

Product

The core product entity that represents a sellable item.
string
required
Unique product identifier (prefix: prod_)
string
required
Product title, searchable and translatable
string
required
URL-friendly identifier for the product
string
Product subtitle, searchable and translatable
string
Product description, searchable and translatable
enum
Product status: draft, proposed, published, rejected
string
URL to the product thumbnail image
boolean
Whether the product is a gift card (default: false)
boolean
Whether discounts can be applied (default: true)
ProductVariant[]
Product variants with different options
ProductOption[]
Available options for variants (e.g., Size, Color)
ProductImage[]
Product images ordered by rank
ProductCollection
Associated product collection
ProductCategory[]
Associated product categories
ProductTag[]
Product tags for organization
ProductType
Product type classification

ProductVariant

Variants represent specific SKUs of a product with unique option combinations.
string
required
Unique variant identifier (prefix: variant_)
string
required
Variant title
string
Stock keeping unit identifier
string
Product barcode
ProductOptionValue[]
Option values for this variant (e.g., Size: Large, Color: Red)
string
required
ID of the parent product

ProductOption

Defines customizable product attributes.
string
required
Unique option identifier
string
required
Option title (e.g., “Size”, “Color”)
ProductOptionValue[]
Available values for this option
string
required
ID of the parent product

ProductCollection

Groups products for marketing and organization.
string
required
Unique collection identifier
string
required
Collection title
string
required
URL-friendly identifier
Product[]
Products in this collection

ProductCategory

Hierarchical product categorization with tree structure.
string
required
Unique category identifier
string
required
Category name
string
required
URL-friendly identifier
ProductCategory
Parent category for nested hierarchies
ProductCategory[]
Child categories
number
Display order within parent category

Service Interface

The Product Module service is available at @medusajs/medusa/product.

Retrieve Product

Retrieve a single product with related data.
string
required
The ID of the product to retrieve
FindConfig
Configuration for the query
string[]
Relations to load (e.g., ["variants", "images", "collection"])
string[]
Fields to select from the product
Context
Shared context for the operation
ProductDTO
The retrieved product

List Products

List products with filtering and pagination.
FilterableProductProps
Filters to apply
string | string[]
Filter by product IDs
ProductStatus[]
Filter by product status
string[]
Filter by collection IDs
object
Filter by category IDs
object
Filter by tag values
FindConfig
Configuration including pagination
number
Number of products to retrieve
number
Number of products to skip
ProductDTO[]
Array of products matching the filters

Create Products

Create one or more products with variants and options.
CreateProductDTO | CreateProductDTO[]
required
Product data to create
string
required
Product title
string
URL-friendly identifier (auto-generated from title if not provided)
ProductStatus
Product status (default: draft)
CreateProductOptionDTO[]
Product options with values
CreateProductVariantDTO[]
Product variants
CreateProductImageDTO[]
Product images
ProductDTO | ProductDTO[]
The created product(s)

Update Products

Update product information.

Create Product Variants

Add variants to existing products.
CreateProductVariantDTO | CreateProductVariantDTO[]
required
Variant data
string
required
ID of the parent product
string
required
Variant title
string
Stock keeping unit
Record<string, string>
Option values (option title to value mapping)

Create Product Collections

Create product collections for grouping.

Create Product Categories

Create hierarchical product categories.
CreateProductCategoryDTO | CreateProductCategoryDTO[]
required
Category data
string
required
Category name
string
URL-friendly identifier (auto-generated from name if not provided)
string
ID of parent category for nesting
number
Display order within parent

Integration Examples

With Pricing Module

Product variants are linked to prices through the Pricing Module.

With Inventory Module

Track inventory levels for product variants.

With Sales Channel Module

Associate products with sales channels for multi-channel selling.

Best Practices

  1. Handle Generation: Always use URL-friendly handles for SEO. If not provided, handles are auto-generated from titles using kebab-case.
  2. Variant Options: Ensure all variants have valid option combinations. The module validates that option values match the product’s defined options.
  3. Image Management: Use the rank field on images to control display order. Variants can have specific images through the variant-image relationship.
  4. Status Management: Use draft status for products being prepared, published for active products, and rejected for products that failed review.
  5. Category Hierarchy: Design your category tree structure before implementation. Use the rank field to control sibling category order.
  6. Translations: Leverage translatable fields (title, description, subtitle, material) for multi-language support.