Sha256: fb2f9017b07e3f4d97f209ca42737ff4f4059704398b52e6e4e81e1fb6133447

Contents?: true

Size: 446 Bytes

Versions: 7

Compression:

Stored size: 446 Bytes

Contents

# frozen_string_literal: true

Spree::Sample.load_sample("products")

size = Spree::OptionType.find_by!(presentation: "Size")
color = Spree::OptionType.find_by!(presentation: "Color")

colored_clothes = [
  "Solidus T-Shirt", "Solidus Long Sleeve", "Solidus Women's T-Shirt"
]

Spree::Product.all.find_each do |product|
  product.option_types = [size]
  product.option_types << color if colored_clothes.include?(product.name)
  product.save!
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solidus_sample-4.2.4 db/samples/product_option_types.rb
solidus_sample-4.1.5 db/samples/product_option_types.rb
solidus_sample-4.1.4 db/samples/product_option_types.rb
solidus_sample-4.2.3 db/samples/product_option_types.rb
solidus_sample-4.2.2 db/samples/product_option_types.rb
solidus_sample-4.2.1 db/samples/product_option_types.rb
solidus_sample-4.2.0 db/samples/product_option_types.rb