Skip to content

Instantly share code, notes, and snippets.

@andrest
Created December 15, 2014 09:44
Show Gist options
  • Save andrest/a64649f128af1bd368ee to your computer and use it in GitHub Desktop.
Save andrest/a64649f128af1bd368ee to your computer and use it in GitHub Desktop.
checkout_controller_decorator.rb
Spree::CheckoutController.class_eval do
def before_address
# If the user has a default address, a callback takes care of setting
# that; but if he doesn't, we need to build an empty one here.
# Regardless of checkout steps, build a shipping address
@order.bill_address ||= Spree::Address.build_default
@order.ship_address ||= Spree::Address.build_default
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment