Sha256: 27345b64102fad1ee4af25a4c56c26623b65f71cca07819bbbd5a7a136d28928

Contents?: true

Size: 764 Bytes

Versions: 42

Compression:

Stored size: 764 Bytes

Contents

Spree::Sample.load_sample('variants')

country =  Spree::Country.find_by(iso: 'US')
location = Spree::StockLocation.first_or_create!(name: 'default',
                                                 address1: 'Example Street',
                                                 city: 'City',
                                                 zipcode: '12345',
                                                 country: country,
                                                 state: country.states.first)
location.active = true
location.save!

Spree::Variant.all.each do |variant|
  next if variant.is_master? && variant.product.has_variants?

  variant.stock_items.each do |stock_item|
    Spree::StockMovement.create(quantity: 10, stock_item: stock_item)
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
spree_sample-4.0.9 db/samples/stock.rb
spree_sample-4.0.8 db/samples/stock.rb
spree_sample-3.7.14.1 db/samples/stock.rb
spree_sample-4.0.7.1 db/samples/stock.rb
spree_sample-4.0.7 db/samples/stock.rb
spree_sample-3.7.14 db/samples/stock.rb
spree_sample-4.0.6 db/samples/stock.rb
spree_sample-3.7.13 db/samples/stock.rb
spree_sample-4.0.5 db/samples/stock.rb
spree_sample-3.7.12 db/samples/stock.rb
spree_sample-4.0.4 db/samples/stock.rb
spree_sample-3.7.11 db/samples/stock.rb
spree_sample-3.7.10 db/samples/stock.rb
spree_sample-4.0.3 db/samples/stock.rb
spree_sample-3.7.9 db/samples/stock.rb
spree_sample-4.0.2 db/samples/stock.rb
spree_sample-3.7.8 db/samples/stock.rb
spree_sample-4.0.1 db/samples/stock.rb
spree_sample-3.7.7 db/samples/stock.rb
spree_sample-4.0.0 db/samples/stock.rb