Sha256: 8ac0b6822d6cdfac1470a60ffcddce83845cc20cd022508ec078584ca5628f6c

Contents?: true

Size: 724 Bytes

Versions: 2

Compression:

Stored size: 724 Bytes

Contents

module Workarea
  class FreeShippingPromoSeeds
    def perform
      puts "Adding free shipping discount with message..."

      create_shipping_message_discount
    end

    def create_shipping_message_discount
      shipping_service = Shipping::Service.where(name: "Ground").first || Shipping::Service.all.first

      discount = Pricing::Discount::Shipping.create!(
        name: "Free Shipping Over $50",
        shipping_service: shipping_service,
        amount: 0.to_m,
        order_total_operator: :greater_than,
        order_total: 50.to_m,
        message_active: true,
        message_applied: "You got FREE SHIPPING!",
        message: "You're only {amount} away from FREE SHIPPING!"
      )
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
workarea-shipping_message-1.2.1 app/seeds/workarea/free_shipping_promo_seeds.rb
workarea-shipping_message-1.2.0 app/seeds/workarea/free_shipping_promo_seeds.rb