Sha256: f7a87ef13bece53736165bbd181baf8972b08dd74a0c04e5438f08f07f7071c0
Contents?: true
Size: 656 Bytes
Versions: 113
Compression:
Stored size: 656 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 || Spree::Country.default) eligibility_errors.add(:base, eligibility_error_message(:wrong_country)) end eligibility_errors.empty? end end end end end
Version data entries
113 entries across 113 versions & 1 rubygems