From 659de3d24d9a732d216ec7ca625aa787106add51 Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Thu, 2 Jul 2020 20:54:07 +0100 Subject: [PATCH] Replay spree commit a4622ee13a723f0dba2943967b445b9989f67fb2 to fix issue introduced in spree 2.1 --- app/models/spree/shipment.rb | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/models/spree/shipment.rb b/app/models/spree/shipment.rb index 993fa0f62c..99d3a57fc0 100644 --- a/app/models/spree/shipment.rb +++ b/app/models/spree/shipment.rb @@ -107,11 +107,14 @@ module Spree def refresh_rates return shipping_rates if shipped? + # The call to Stock::Estimator below will replace the current shipping_method + original_shipping_method_id = shipping_method.try(:id) + self.shipping_rates = OrderManagement::Stock::Estimator.new(order).shipping_rates(to_package) - if shipping_method + if original_shipping_method_id selected_rate = shipping_rates.detect { |rate| - rate.shipping_method_id == shipping_method.id + rate.shipping_method_id == original_shipping_method_id } self.selected_shipping_rate_id = selected_rate.id if selected_rate end