Sha256: 9e3c37c3a6b7bd6f8afc411eaf612b847fdb63a0bafa63ff343232af6b13128f
Contents?: true
Size: 361 Bytes
Versions: 3
Compression:
Stored size: 361 Bytes
Contents
module Spree InventoryUnit.class_eval do def percentage_of_line_item product = line_item.product if product.assembly? total_value = line_item.quantity_by_variant.map { |part, quantity| part.price * quantity }.sum variant.price / total_value else 1 / BigDecimal.new(line_item.quantity) end end end end
Version data entries
3 entries across 3 versions & 2 rubygems