Units of Measure (UOM)
Dynamic conversion logic for inventory and sales units.
UOM Engine
The Unit of Measure (UOM) engine provides dynamic conversion logic ensuring accurate inventory management when buying and selling in different units.
Logic Overview
| Conversion Type | Logic | Example |
|---|---|---|
| Direct | Factor * Quantity | 1 Box = 12 Pieces |
| Available UOMs | Defined per product | Sell by Piece, Stock by Box |
Usage Guide
You can convert quantities between defined units easily using the uomConverter facade.
Converting Units
use Obelaw\Pim\Facades\PIM;
$converter = PIM::uomConverter();
// Define your UOMs (Logic handled in database seeding/creation)
// $boxUom (factor 12)
// $pieceUom (factor 1)
// Convert 5 Boxes to Pieces
$pieces = $converter->convert(5, $boxUom, $pieceUom);
// Result: 60.0