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
This commit is contained in:
luisramos0
2019-09-09 16:58:47 +01:00
parent c4d5eec7fd
commit cc7461e692

View File

@@ -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?