core/app/models/spree/variant.rb
# Ensures a new variant takes the product master price when price is not supplied
Ensures a new variant takes the product master price when price is not supplied
Ensures a new variant takes the product master price when price is not supplied
def check_price
        if price.nil? && Spree::Config[:require_master_price]
          raise 'No master variant found to infer price' unless (product && product.master)
          raise 'Must supply price for variant or master.price for product.' if self == product.master
          self.price = product.master.price
        end
        if currency.nil?
          self.currency = Spree::Config[:currency]
        end
      end
def check_price if price . nil? && Spree :: Config [ :require_master_price ] raise 'No master variant found to infer price' unless ( product && product . master ) raise 'Must supply price for variant or master.price for product.' if self == product . master self . price = product . master . price end if currency . nil? self . currency = Spree :: Config [ :currency ] end end
Ensures a new variant takes the product master price when price is not supplied
Ensures a new variant takes the product master price when price is not supplied