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.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Remove outdated prompt for leave blank.
Matthew Kennedy980173bbef15
diff --git a/backend/app/views/spree/admin/payment_methods/_form.html.erb b/backend/app/views/spree/admin/payment_methods/_form.html.erbindex a5ff976679..68a2a8d3ac 100644--- a/backend/app/views/spree/admin/payment_methods/_form.html.erb+++ b/backend/app/views/spree/admin/payment_methods/_form.html.erb@@ -27,7 +27,6 @@<div data-hook="store" class="form-group"><%= label_tag :payment_method_store, Spree.t(:stores) %><%= collection_select(:payment_method, :store_ids, @stores, :id, :unique_name, {}, { multiple: true, id: 'store_id', class: 'select2' }) %>- <small class="form-text text-muted"><%= Spree.t('payment_method_form.stores_help') %></small></div><div data-hook="display" class="form-group">diff --git a/core/app/models/spree/payment_method.rb b/core/app/models/spree/payment_method.rbindex 93a3f87a14..a1db8f7440 100644--- a/core/app/models/spree/payment_method.rb+++ b/core/app/models/spree/payment_method.rb@@ -79,6 +79,8 @@ module Spreeenddef available_for_store?(store)+ return false if store.blank?+store_ids.include?(store.id)endenddiff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex f5453ca364..0c2d4e7424 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -1249,8 +1249,6 @@ en:payment_identifier: Payment Identifierpayment_information: Payment Informationpayment_method: Payment Method- payment_method_form:- stores_help: Leave blank to show this payment method in all stores.payment_methods: Payment Methodspayment_method_not_supported: That payment method is unsupported. Please choose another one.payment_processing_failed: Payment could not be processed, please check the details you entereddiff --git a/core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rb b/core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rbindex 5f4ca605c4..2ae63c3099 100644--- a/core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rb+++ b/core/db/migrate/20210114220232_remove_store_id_from_spree_payment_methods.rb@@ -1,20 +1,19 @@class RemoveStoreIdFromSpreePaymentMethods < ActiveRecord::Migration[6.0]-def upSpree::PaymentMethod.all.each do |payment_method|- if payment_method.store_id.nil?- Spree::Store.all.each do |store|- payment_method.store_ids = store.id- payment_method.save- end- else- payment_method.store_ids = [:store_id]- payment_method.save- end- end+ next if payment_method.store_ids.any?++ payment_method.store_ids = if payment_method[:store_id].present?+ payment_method[:store_id]+ else+ Spree::Store.ids+ end++ payment_method.save+ endenddef change- remove_column :spree_payment_methods, :store_id, :integer+ remove_column :spree_payment_methods, :store_idendend