Overview
In Spree each Variant has aStockItem. This is the place where the inventory for that variant is stored. Variant can have multiple StockItems if they are available in multiple StockLocations.
Back-ordered, sold, or shipped products are stored as individual InventoryUnit objects so they can have relevant information attached to them.
New products created in the system can be given a starting “on hand” inventory level. You can subsequently set new inventory levels and the correct things will happen, e.g. adding new on-hand inventory to an out-of-stock product that has some backorders will first fill the backorders then update the product with the remaining inventory count.
Inventory Management
Stock Locations
Stock Locations are the locations where your inventory is shipped from. EachStockLocation has many stock_items and stock_movements.
Stock Locations can be created in the admin panel (Configuration → Stock Locations) or via Platform API.
Stock Locations have several attributes that define their properties and behavior within the Spree system. Below is a table outlining these attributes:
Stock Locations can be easily used for tracking warehouses and other physical locations. They can be used to track separate sections of a warehouse (e.g. aisles, shelves, etc.) or to track different warehouses.
You can easily use them with your Point of Sale (POS) system to track inventory at different locations.
Stock Items
Stock Items represent the inventory at a stock location for a specific variant. Stock item count on hand can be increased or decreased by creating stock movements.Stock Transfers
Stock transfers allow you to move inventory in bulk from one stock location to another stock location. This is handy when you want to integrate with a POS system or other inventory management system. Or you can just rely on Spree being the source of truth for your inventory.Stock Transfers can be created in the Admin dashboard or via the Platform API.
Stock transfers are crucial for managing inventory across multiple locations, ensuring that stock levels are accurate and up-to-date.
Each Stock Transfer will hold a list of Stock Movements.
Stock Movements
Stock Movements track the movement of the inventory:- when you move inventory between stock locations (via Stock Transfer)
- when you add inventory to a stock location
- when you remove inventory from a stock location
- when customers purchase products
- when customers return products
Stock Movements are crucial for maintaining accurate inventory levels and for historical tracking of inventory adjustments.
Inventory Units
As we mentioned above, back-ordered, sold, or shipped products are stored as individualInventoryUnit objects so they can have relevant information attached to them.
We create InventoryUnit objects when:
- a product is sold (they are added to the Shipment)
- a product is returned
Inventory Units states are:
on_hand- the inventory unit is on handbackordered- the inventory unit is backorderedshipped- the inventory unit is shipped
As we noted before, when you add new Stock Items to a Variant (eg. via Admin Panel or Platform API), the first Inventory Units to fulfill are the backordered ones.
Disabling inventory tracking
What if you don’t need to track inventory? You can disable it for the entire application inconfig/initializers/spree.rb file which was generated during installation. Add the following line:
track_inventory column to false, eg.

