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.

Do not use currency from the session in the admin panel (#12214)

Damian Kaczmarczyk3c0c51197ec9
diff --git a/admin/app/controllers/spree/admin/base_controller.rb b/admin/app/controllers/spree/admin/base_controller.rb
index 50e2e7a76b..f06ab5f952 100644
--- a/admin/app/controllers/spree/admin/base_controller.rb
+++ b/admin/app/controllers/spree/admin/base_controller.rb
@@ -73,6 +73,16 @@ module Spree
@current_timezone ||= current_store.timezone
end
+ def current_currency
+ @current_currency ||= if params[:currency].present? && supported_currency?(params[:currency])
+ params[:currency]
+ elsif current_store.present?
+ current_store.default_currency
+ else
+ Spree::Store.default.default_currency
+ end&.upcase
+ end
+
def current_vendor
nil
end