Sha256: 2bafb9c776882f2a23aec4c96c374f004dd98414bff4ea3ceac991155e7c2b9f

Contents?: true

Size: 745 Bytes

Versions: 35

Compression:

Stored size: 745 Bytes

Contents

Spree::Sample.load_sample('option_values')
Spree::Sample.load_sample('products')

product = Spree::Product.find_by!(name: 'Denim Shirt')
size = Spree::OptionValue.find_by!(name: 'xs')
color = Spree::OptionValue.find_by!(name: 'red')
eligible_values = "#{size.id},#{color.id}"

promotion = Spree::Promotion.where(
  name: 'free shipping',
  usage_limit: nil,
  path: nil,
  match_policy: 'any',
  description: ''
).first_or_create!

Spree::PromotionRule.where(
  promotion_id: promotion.id,
  type: 'Spree::Promotion::Rules::OptionValue',
  preferences: { match_policy: 'any', eligible_values: { product.id.to_s => eligible_values } }
).first_or_create!

Spree::Promotion::Actions::FreeShipping.where(promotion_id: promotion.id).first_or_create!

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
spree_sample-4.1.15 db/samples/promotions.rb
spree_sample-4.2.7 db/samples/promotions.rb
spree_sample-4.2.6 db/samples/promotions.rb
spree_sample-4.2.5 db/samples/promotions.rb
spree_sample-4.1.14 db/samples/promotions.rb
spree_sample-4.2.4 db/samples/promotions.rb
spree_sample-4.2.3.1 db/samples/promotions.rb
spree_sample-4.1.13.1 db/samples/promotions.rb
spree_sample-4.2.3 db/samples/promotions.rb
spree_sample-4.2.2 db/samples/promotions.rb
spree_sample-4.2.1 db/samples/promotions.rb
spree_sample-4.2.0 db/samples/promotions.rb
spree_sample-4.2.0.rc5 db/samples/promotions.rb
spree_sample-4.2.0.rc4 db/samples/promotions.rb
spree_sample-4.2.0.rc3 db/samples/promotions.rb
spree_sample-4.1.13 db/samples/promotions.rb
spree_sample-4.2.0.rc2 db/samples/promotions.rb
spree_sample-4.1.12 db/samples/promotions.rb
spree_sample-4.2.0.rc1 db/samples/promotions.rb
spree_sample-4.1.11 db/samples/promotions.rb