Sha256: 644bbc4a13272facdeffb278d37046655afb3b56ef6094194f37cbd72d22f35e

Contents?: true

Size: 418 Bytes

Versions: 2

Compression:

Stored size: 418 Bytes

Contents

# frozen_string_literal: true

module SolidusLegacyPromotions
  module SpreeLineItemDecorator
    def self.prepended(base)
      base.has_many :line_item_actions, dependent: :destroy
      base.has_many :actions, through: :line_item_actions
    end

    def total_before_tax
      amount + adjustments.select { |value| !value.tax? && value.eligible? }.sum(&:amount)
    end

    Spree::LineItem.prepend self
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
solidus_legacy_promotions-4.4.2 app/decorators/solidus_legacy_promotions/models/spree_line_item_decorator.rb
solidus_legacy_promotions-4.4.1 app/decorators/solidus_legacy_promotions/models/spree_line_item_decorator.rb