Promotion (rules/product.rb)

solidus · legacy_promotions/app/models/spree/promotion/rules/product.rb · ruby · BSD-3-Clause
pos

Defines a product‑based promotion rule for Spree e‑commerce, handling eligibility and actions.

# Source: https://github.com/solidusio/solidus | License: BSD-3-Clause | Copyright 2007-2014, Spree Commerce Inc. and other contributors
# Provided via justclaw.it.com; keep this notice with the code.
# frozen_string_literal: true

module Spree
  class Promotion < Spree::Base
    module Rules
      # A rule to limit a promotion based on products in the order.  Can
      # require all or any of the products to be present.  Valid products
      # either come from assigned product group or are assingned directly to
      # the rule.
      class Product < PromotionRule
        has_many :product_promotion_rules,
          dependent: :destroy,
          foreign_key: :promotion_rule_id,
          class_name: "Spree::ProductPromotionRule",
          inverse_of: :promotion_rule
        has_many :pr

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

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

Get a free API key