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
Don't display Store dropdown when it shouldn't be
Damian Legawiecf775dc2a3e18
diff --git a/backend/app/views/spree/admin/payment_methods/_form.html.erb b/backend/app/views/spree/admin/payment_methods/_form.html.erbindex bef9dc34ec..065a77b700 100644--- a/backend/app/views/spree/admin/payment_methods/_form.html.erb+++ b/backend/app/views/spree/admin/payment_methods/_form.html.erb@@ -24,7 +24,7 @@<%= text_area :payment_method, :description, { cols: 60, rows: 6, class: 'form-control' } %><% end %>- <% if @payment_method.persisted? %>+ <% if @stores.count > 1 %><div data-hook="store" class="form-group"><%= label_tag :payment_method_stores, Spree.t(:stores) %><%= collection_select(:payment_method, :store_ids, @stores, :id, :unique_name, {}, { multiple: true, class: 'select2' }) %>diff --git a/backend/app/views/spree/admin/products/_form.html.erb b/backend/app/views/spree/admin/products/_form.html.erbindex 9d7f5268d0..4f97a3dd90 100644--- a/backend/app/views/spree/admin/products/_form.html.erb+++ b/backend/app/views/spree/admin/products/_form.html.erb@@ -237,12 +237,14 @@<% end %></div>- <div data-hook="admin_product_form_stores">- <%= f.field_container :stores, class: ['form-group'] do %>- <%= f.label :product_stores, Spree.t(:stores) %>- <%= collection_select(:product, :store_ids, @stores, :id, :unique_name, {}, { multiple: true, class: 'select2' }) %>- <% end %>- </div>+ <% if @stores.count > 1 %>+ <div data-hook="admin_product_form_stores">+ <%= f.field_container :stores, class: ['form-group'] do %>+ <%= f.label :product_stores, Spree.t(:stores) %>+ <%= collection_select(:product, :store_ids, @stores, :id, :unique_name, {}, { multiple: true, class: 'select2' }) %>+ <% end %>+ </div>+ <% end %><div data-hook="admin_product_form_meta"><div data-hook="admin_product_form_meta_title">diff --git a/backend/app/views/spree/admin/promotions/_form.html.erb b/backend/app/views/spree/admin/promotions/_form.html.erbindex 724ae6dd00..ec2c05454c 100644--- a/backend/app/views/spree/admin/promotions/_form.html.erb+++ b/backend/app/views/spree/admin/promotions/_form.html.erb@@ -46,9 +46,11 @@<%= f.collection_select(:promotion_category_id, @promotion_categories, :id, :name, { include_blank: Spree.t('match_choices.none') }, { class: 'select2 w-100' }) %><% end %>- <%= f.field_container :stores, class: ['form-group'] do %>- <%= f.label :promotion_stores, Spree.t(:stores) %>- <%= collection_select(:promotion, :store_ids, @stores, :id, :unique_name, {}, { multiple: true, class: 'select2' }) %>+ <% if @stores.count > 1 %>+ <%= f.field_container :stores, class: ['form-group'] do %>+ <%= f.label :promotion_stores, Spree.t(:stores) %>+ <%= collection_select(:promotion, :store_ids, @stores, :id, :unique_name, {}, { multiple: true, class: 'select2' }) %>+ <% end %><% end %></div>