Sha256: 7da250663549423bd681dae0fe4c008c818d0f7d6322ebd300adc5167dc1e3a4

Contents?: true

Size: 744 Bytes

Versions: 2

Compression:

Stored size: 744 Bytes

Contents

module Workarea
  module Pricing
    module Calculators
      class BundledItemCalculator
        include Calculator

        def adjust
          order.bundled_items.each do |item|
            price = pricing.for_sku(item.sku, quantity: item.quantity)

            item.adjust_pricing(
              price: 'item',
              quantity: item.quantity,
              calculator: self.class.name,
              amount: price.sell * item.quantity,
              description: 'Item Subtotal',
              data: {
                'on_sale' => price.on_sale?,
                'original_price' => price.regular.to_f,
                'tax_code' => price.tax_code
              }
            )
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-product_bundles-1.0.1 app/models/workarea/pricing/calculators/bundled_item_calculator.rb
workarea-product_bundles-1.0.0 app/models/workarea/pricing/calculators/bundled_item_calculator.rb