Sha256: f65a015369a9c07926da361dfeabf6cf52cbbaa84014ba51f5a626e38085469d
Contents?: true
Size: 616 Bytes
Versions: 104
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
104 entries across 104 versions & 3 rubygems