Sha256: 0e316221a08b62b56c3de70504a1524827e7619d7b2042b6a43a99ce5b08de48
Contents?: true
Size: 664 Bytes
Versions: 33
Compression:
Stored size: 664 Bytes
Contents
# A rule to limit a promotion based on shipment country. module Spree class Promotion module Rules class Country < PromotionRule preference :country_id, :integer def applicable?(promotable) promotable.is_a?(Spree::Order) end def eligible?(order, options = {}) country_id = options[:country_id] || order.ship_address.try(:country_id) unless country_id.eql?(preferred_country_id || order.store.default_country_id) eligibility_errors.add(:base, eligibility_error_message(:wrong_country)) end eligibility_errors.empty? end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems