Created
June 29, 2012 02:40
-
-
Save bryanmtl/3015332 to your computer and use it in GitHub Desktop.
Allows coupons to be added to Spree orders in a non-complete state, regardless of the date the order was created on
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Extensions | |
module Spree | |
module Promotion | |
extend ActiveSupport::Concern | |
included do | |
alias_method_chain :order_activatable?, :no_date_limitation | |
end | |
def order_activatable_with_no_date_limitation?(order) | |
order && | |
code.present? ? true : created_at.to_i < order.created_at.to_i && | |
!::Spree::Promotion::UNACTIVATABLE_ORDER_STATES.include?(order.state) | |
end | |
end | |
end | |
end | |
::Spree::Promotion.send(:include, Extensions::Spree::Promotion) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment