Skip to content

Instantly share code, notes, and snippets.

@braidn
Created September 30, 2014 13:59
Show Gist options
  • Save braidn/777cce5e81f6c9dd7612 to your computer and use it in GitHub Desktop.
Save braidn/777cce5e81f6c9dd7612 to your computer and use it in GitHub Desktop.
module Extensions
module Spree
module CheckoutCallbacks
extend ActiveSupport::Concern
included do
set_callback :updating_from_params, :after, :clear_empty_payment
def clear_empty_payment
#self in this case is the order object
byebug
if self.payments && self.payments.count > 1
self.payments.last.delete
end
end
end
end
end
end
::Spree::Order::Checkout.send(:include, Extensions::Spree::CheckoutCallbacks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment