Method: Spree::LineItem#options=
- Defined in:
- app/models/spree/line_item.rb
#options=(options = {}) ⇒ Object
Sets the options on the line item according to the order’s currency or one passed in.
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 |
# File 'app/models/spree/line_item.rb', line 135 def (={}) return unless .present? opts = .dup # we will be deleting from the hash, so leave the caller's copy intact currency = opts.delete(:currency) || order.try(:currency) if currency self.currency = currency self.price = variant.price_in(currency).amount + variant.price_modifier_amount_in(currency, opts) else self.price = variant.price + variant.price_modifier_amount(opts) end self.assign_attributes opts end |