diff --git a/core/app/models/spree/order.rb b/core/app/models/spree/order.rb index 0879750f89d..781fee27007 100644 --- a/core/app/models/spree/order.rb +++ b/core/app/models/spree/order.rb @@ -522,7 +522,7 @@ def restart_checkout_flow state: 'cart', updated_at: Time.current ) - self.next + self.next if line_items.any? end def refresh_shipment_rates diff --git a/core/spec/models/spree/order_spec.rb b/core/spec/models/spree/order_spec.rb index aa54291df27..ac08a062738 100644 --- a/core/spec/models/spree/order_spec.rb +++ b/core/spec/models/spree/order_spec.rb @@ -594,6 +594,14 @@ def merge!(other_order, user = nil) order = create(:order, state: "delivery") expect{ order.restart_checkout_flow }.to change{ order.state }.from("delivery").to("cart") end + + it "doesn't add errors to the order" do + order = create(:order, state: "delivery", line_items: []) + + order.restart_checkout_flow + + expect(order.errors).to be_empty + end end end