Method: Spree::LineItem#copy_price

Defined in:
app/models/spree/line_item.rb

#copy_priceObject

Sets this line item’s price, cost price, and currency from this line item’s variant if they are nil and a variant is present.



45
46
47
48
49
50
51
# File 'app/models/spree/line_item.rb', line 45

def copy_price
  if variant
    self.price = variant.price if price.nil?
    self.cost_price = variant.cost_price if cost_price.nil?
    self.currency = variant.currency if currency.nil?
  end
end