Inventory units
A Spree::InventoryUnit
object is created every time that an item is sold.
It tracks a sold item as it changes location: from being a sold item waiting in the
warehouse to be shipped, to being a shipped item (or potentially a returned item).
Note that the Spree::InventoryUnit
tracks an item as an object associated with
a Spree::Order
, a Spree::Shipment
and a specific Spree::LineItem
. This
allows you to more closely track the status of an order and the line items and
shipments associated with it.
A Spree::InventoryUnit
object has the following attributes:
state
: The current state of the inventory unit. The state value can beon_hand
,backordered
,shipped
, orreturned
.variant_id
: The ID for theSpree::Variant
corresponding with the inventory unit that has been sold.shipment_id
: The ID for theSpree::Shipment
that the inventory unit is being shipped in.pending
: Documents whether the current unit is pending or finalized. Iftrue
, the stock for this unit has not yet been allocated to a shipment. Iffalse
, the stock has been finalized and is no longer tracked in theSpree::StockItem
'scount_on_hand
value.line_item_id
: The ID for theSpree::LineItem
that the inventory unit corresponds with.carton_id
: The ID for theSpree::Carton
that the inventory unit belongs to.