Skip to content

armgit / spree

Public Imported from GitHub
0

Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.

Fix changing selected shipping_rate not busting serializer cache (#11697)

Karol Szuster6dc50346e70f
diff --git a/core/app/models/spree/shipment.rb b/core/app/models/spree/shipment.rb
index f78f958c00..aa048b409f 100644
--- a/core/app/models/spree/shipment.rb
+++ b/core/app/models/spree/shipment.rb
@@ -250,6 +250,7 @@ module Spree
def selected_shipping_rate_id=(id)
shipping_rates.update_all(selected: false)
+ shipping_rates.touch_all # Bust cache dependent on "updated_at" timestamp
shipping_rates.update(id, selected: true)
save!
end