# generateVariants

## Overview

Generates all product variant combinations from the product's variant-axis attributes and creates a corresponding inventory item for each variant.

## Modules Commands Used

- `product-management.GenerateVariants` — reads the product's variant-axis attribute values, computes the Cartesian product, persists each resulting variant record, and creates inventory items internally via the wired item-management dependency

## Exception Handling

| Error Code | Description |
| --- | --- |
| PRODUCT_NOT_FOUND | No product exists with the given ID |
| INVALID_PRODUCT_STATUS | The product must be in active status before variants can be generated |
| NO_VARIANT_AXES | The product has no attributes designated as variant axes, so no combinations can be generated |
| ATTRIBUTE_NOT_FOUND | A referenced attribute does not exist |
| ATTRIBUTE_VALUE_NOT_FOUND | A referenced attribute value does not exist |
| ITEM_CREATION_FAILED | One or more inventory items could not be created for the generated variants |
