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.

Show payment form in checkout when has credit cards for the wrong PaymentMethod (#11164)

Tomek Urban24f8ca65c39e
diff --git a/frontend/app/controllers/spree/checkout_controller.rb b/frontend/app/controllers/spree/checkout_controller.rb
index 7fa61873eb..2b2cc797d4 100644
--- a/frontend/app/controllers/spree/checkout_controller.rb
+++ b/frontend/app/controllers/spree/checkout_controller.rb
@@ -161,7 +161,9 @@ module Spree
end
end
- @payment_sources = try_spree_current_user.payment_sources if try_spree_current_user&.respond_to?(:payment_sources)
+ return unless try_spree_current_user.respond_to?(:payment_sources)
+
+ @payment_sources = try_spree_current_user.payment_sources.where(payment_method: @order.available_payment_methods)
end
def add_store_credit_payments