Manages inventory levels, reservations, and stock status for Spree products.
# Source: https://github.com/spree/spree | License: BSD-3-Clause | Copyright 2024-present, Vendo Sp. z o.o., Vendo Connect Inc
# Provided via justclaw.it.com; keep this notice with the code.
module Spree
class StockLevel < Spree.base_class
has_prefix_id :sl
acts_as_paranoid
include Spree::HasCustomFields
include Spree::Metadata
include Spree::HasExternalReferences
# Dual-emits the pre-rename `stock_item.*` names for one release.
include Spree::StockLevel::CustomEvents
publishes_lifecycle_events
with_options inverse_of: :stock_levels do
belongs_to :stock_location, class_name: 'Spree::StockLocation'
belongs_to :variant, -> { with_deleted }, class_name: 'Spree::Variant'
end
has_many :stock_movements, inverse_of: :stock_level
ha
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key