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.

Add unique ids to option types

piotrpanko0b5baa616e9f
diff --git a/backend/app/views/spree/admin/variants/_form.html.erb b/backend/app/views/spree/admin/variants/_form.html.erb
index 3971acc0ec..b8b01a5ff8 100644
--- a/backend/app/views/spree/admin/variants/_form.html.erb
+++ b/backend/app/views/spree/admin/variants/_form.html.erb
@@ -6,10 +6,10 @@
<%= label :new_variant, option_type.presentation %>
<% if option_type.name == 'color' %>
<%= f.collection_select 'option_value_ids', option_type.option_values, :id, :name,
- { include_blank: true }, { name: 'variant[option_value_ids][]', class: 'select2' } %>
+ { include_blank: true }, { name: 'variant[option_value_ids][]', class: 'select2', id: "option_value_ids-#{option_type.id}" } %>
<% else %>
<%= f.collection_select 'option_value_ids', option_type.option_values, :id, :presentation,
- { include_blank: true }, { name: 'variant[option_value_ids][]', class: 'select2' } %>
+ { include_blank: true }, { name: 'variant[option_value_ids][]', class: 'select2', id: "option_value_ids-#{option_type.id}" } %>
<% end %>
</div>
<% end %>