Forked from momolog/checkout_controller_decorator.rb
Created
December 3, 2013 04:14
-
-
Save samhamilton/7763792 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Spree::CheckoutController.class_eval do | |
def ensure_checkout_allowed | |
check = @order.checkout_allowed? | |
unless check == true | |
redirect_to spree.cart_path, :flash => {:error => I18n.t("checkout_allowed_errors.#{check}")} | |
end | |
end | |
end |
This file contains hidden or 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
Spree::Order.class_eval do | |
def checkout_allowed? | |
return :not_empty unless line_items.count > 0 | |
return :minimum_value unless total >= 10 | |
true | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment