spree/variant.rb

spree · spree/core/app/models/spree/variant.rb · ruby · BSD-3-Clause
pos

Spree Variant model with full e‑commerce functionality, including pricing and media.

# 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 Variant < Spree.base_class
    has_prefix_id :variant

    acts_as_paranoid
    acts_as_list scope: :product

    include Spree::MemoizedData
    include Spree::HasCustomFields
    include Spree::Metadata
    include Spree::CanonicalDecimals
    include Spree::HasExternalReferences
    include Spree::Searchable
    include Spree::StorePreferences

    publishes_lifecycle_events

    MEMOIZED_METHODS = %w(in_stock on_sale backorderable tax_category tax_category_id options_text compare_at_price)

    DIMENSION_UNITS = %w[mm cm in ft]
    WEIGHT_UNITS = %w[g kg lb oz]

    # What a bu

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key