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.

Refresh stock location cache after changing default stock location (#12209)

Łukasz Adamczykf307b0c0f987
diff --git a/core/app/models/spree/stock_location.rb b/core/app/models/spree/stock_location.rb
index 822410f173..0ed07da8f4 100644
--- a/core/app/models/spree/stock_location.rb
+++ b/core/app/models/spree/stock_location.rb
@@ -146,6 +146,7 @@ module Spree
def ensure_one_default
if default
StockLocation.where(default: true).where.not(id: id).update_all(default: false)
+ StockLocation.where.not(id: id).update_all(updated_at: Time.current)
end
end