* removed the deface override that modified the checkout/_delivery partial * created custom digital delivery calculator * removed digital_shipping_method from Spree::Order. Moved logic to available_shipping_methods monkey patch The main goal was to eliminate the shipping method detection logic from the _delivery partial. This was a bit of a hack all along and didn't really present the correct information to the underlying order logic (i.e. rate_hash.blank? would return true when there was no shipping options available). This should be more future proof and make overriding another aspect of the delivery process easier.
19 lines
352 B
Ruby
19 lines
352 B
Ruby
# https://github.com/spree/spree/issues/1439
|
|
require_dependency 'spree/calculator'
|
|
|
|
module Spree
|
|
class Calculator::DigitalDelivery < Calculator::FlatRate
|
|
def self.description
|
|
I18n.t(:digital_delivery)
|
|
end
|
|
|
|
def compute(object=nil)
|
|
self.preferred_amount
|
|
end
|
|
|
|
def available?(order)
|
|
order.digital?
|
|
end
|
|
end
|
|
end
|