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.

Use store default currency for user total available store credit

Szymon Iwaczd1319ffd5311
diff --git a/core/app/models/concerns/spree/user_methods.rb b/core/app/models/concerns/spree/user_methods.rb
index 7430b45370..20ce385e94 100644
--- a/core/app/models/concerns/spree/user_methods.rb
+++ b/core/app/models/concerns/spree/user_methods.rb
@@ -60,8 +60,8 @@ module Spree
end
def total_available_store_credit(currency = nil, store = nil)
- currency ||= Spree::Config[:currency]
store ||= Store.default
+ currency ||= store.default_currency
store_credits.for_store(store).where(currency: currency).reload.to_a.sum(&:amount_remaining)
end