Sha256: 257ef1646b042183b81442392a2ce0a63fd514480e268088832e9a0e5ee397bc
Contents?: true
Size: 616 Bytes
Versions: 165
Compression:
Stored size: 616 Bytes
Contents
module Spree class Promotion module Rules class OneUsePerUser < PromotionRule def applicable?(promotable) promotable.is_a?(Spree::Order) end def eligible?(order, _options = {}) if order.user.present? if promotion.used_by?(order.user, [order]) eligibility_errors.add(:base, eligibility_error_message(:limit_once_per_user)) end else eligibility_errors.add(:base, eligibility_error_message(:no_user_specified)) end eligibility_errors.empty? end end end end end
Version data entries
165 entries across 165 versions & 2 rubygems