# createProductVariant

## Overview

Creates a product variant linking an existing ACTIVE product to an existing item. Used by the product migration script to create variants with specific canonical SKUs (bypasses `generateVariants` which auto-generates sequential SKUs).

Computes `axisValueKey` from the provided color and size attribute value IDs (sorted, pipe-separated).

## Modules Commands Used

- Custom resolver (direct Kysely insert into ProductVariant — does not use erp-kit GenerateVariants command)

## Exception Handling

| Error Code | Description |
| --- | --- |
| PRODUCT_NOT_FOUND | The specified product does not exist |
| PRODUCT_NOT_ACTIVE | The product exists but is not in ACTIVE status |
| ITEM_NOT_FOUND | The specified item does not exist |
