Skip to content

Instantly share code, notes, and snippets.

@bver
Created July 10, 2011 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bver/1074574 to your computer and use it in GitHub Desktop.
Save bver/1074574 to your computer and use it in GitHub Desktop.
class Calculator::FreeShipping < Calculator
preference :threshold, :decimal, :default => 0
def available?(order)
order.item_total >= self.preferred_threshold
end
def self.description
I18n.t("free_shipping")
end
def self.register
super
ShippingMethod.register_calculator(self)
end
def compute(object=nil)
0.0
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment