Sha256: 71d3ed30b29de9816ebaada2808c24fac2e6db749f9bef3b4fd1e85b4f6aabbd

Contents?: true

Size: 542 Bytes

Versions: 4

Compression:

Stored size: 542 Bytes

Contents

# frozen_string_literal: true

module SolidusVolumePricing
  class PricingOptions < ::Spree::Variant::PricingOptions
    attr_accessor :quantity, :user

    def initialize(options = {})
      super options.except(:quantity, :user)
      @quantity = options.delete(:quantity)
      @user = options.delete(:user)
    end

    def self.from_line_item(line_item)
      pricing_options = super(line_item)
      pricing_options.quantity = line_item.quantity
      pricing_options.user = line_item.order.user
      pricing_options
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
solidus_volume_pricing-1.2.0 app/models/solidus_volume_pricing/pricing_options.rb
solidus_volume_pricing-1.1.1 app/models/solidus_volume_pricing/pricing_options.rb
solidus_volume_pricing-1.1.0 app/models/solidus_volume_pricing/pricing_options.rb
solidus_volume_pricing-1.0.0 app/models/solidus_volume_pricing/pricing_options.rb