Skip to content

Commit

Permalink
Add missing product option types
Browse files Browse the repository at this point in the history
Sample products data was reworked with #solidusio/pull/5437.
After these changes, some products with variants remained without
option types, meaning that their variants remained not visible and
selectable on the FE, and in the admin it was not possible to add
new ones as the relevant button was hidden.
  • Loading branch information
spaghetticode committed Feb 2, 2024
1 parent c9b62b1 commit 4566b49
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions sample/db/samples/product_option_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,17 @@
size = Spree::OptionType.find_by!(presentation: "Size")
color = Spree::OptionType.find_by!(presentation: "Color")

solidus_cap = Spree::Product.find_by!(name: "Solidus cap")
products_with_variants = [
"Solidus cap",
"Solidus hoodie",
"Solidus t-shirt",
"Solidus mug set",
"Solidus tote",
"Solidus Water Bottle"
]

solidus_cap.option_types = [size, color]
solidus_cap.save!

solidus_hoodie = Spree::Product.find_by!(name: "Solidus hoodie")

solidus_hoodie.option_types = [size, color]
solidus_hoodie.save!
products_with_variants.each do |name|
product = Spree::Product.find_by!(name: name)
product.option_types = [size, color]
product.save!
end

0 comments on commit 4566b49

Please sign in to comment.