From cc7461e69278c8ff99481688f4654a0b74beec0d Mon Sep 17 00:00:00 2001 From: luisramos0 Date: Mon, 9 Sep 2019 16:58:47 +0100 Subject: [PATCH] Remove clear_ship_address from checkout_controller because it is setting an empty address on order.ship_address which is breaking the reset_checkout process in some cases. This logic is already repeated in the before_save hook in the OrderUpdater where the distributor address is put into the ship_address on order.finalize In cases the order is not to be finalized we keep the ship_address sent from the client as we may need it to make the order workflow work properly --- app/controllers/checkout_controller.rb | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/app/controllers/checkout_controller.rb b/app/controllers/checkout_controller.rb index c1fe12ce53..240e736645 100644 --- a/app/controllers/checkout_controller.rb +++ b/app/controllers/checkout_controller.rb @@ -152,7 +152,6 @@ class CheckoutController < Spree::CheckoutController end def update_failed - clear_ship_address RestartCheckout.new(@order).call respond_to do |format| @@ -165,15 +164,6 @@ class CheckoutController < Spree::CheckoutController end end - # When we have a pickup Shipping Method, - # we clone the distributor address into ship_address before_save - # We don't want this data in the form, so we clear it out - def clear_ship_address - unless current_order.shipping_method.andand.require_ship_address - current_order.ship_address = Spree::Address.default - end - end - def load_order @order = current_order redirect_to(main_app.shop_path) && return unless @order && @order.checkout_allowed?