Sha256: 8e58ee88c5d38a42d389814207f2250fa4892369724a8dbeb1d22858a5b645b2
Contents?: true
Size: 829 Bytes
Versions: 32
Compression:
Stored size: 829 Bytes
Contents
Spree::Sample.load_sample('stores') 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 do |promo| promo.stores = Spree::Store.all end 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
32 entries across 32 versions & 1 rubygems