Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save samhamilton/7763792 to your computer and use it in GitHub Desktop.
Save samhamilton/7763792 to your computer and use it in GitHub Desktop.
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
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