Skip to content

Commit

Permalink
Merge pull request #5638 from nebulab/spaghetticode/add-missing-produ…
Browse files Browse the repository at this point in the history
…ct-option-types

Add missing option types to product sample data
  • Loading branch information
spaghetticode authored Feb 5, 2024
2 parents c9b62b1 + 55ecd5b commit 1ae30d0
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 1ae30d0

Please sign in to comment.