Skip to content

Instantly share code, notes, and snippets.

@BDQ
Created July 23, 2012 15:55
Show Gist options
  • Save BDQ/3164364 to your computer and use it in GitHub Desktop.
Save BDQ/3164364 to your computer and use it in GitHub Desktop.
Create Spree::Promotion for free shipping via console.
p = Spree::Promotion.create(event_name: "spree.checkout.coupon_code_added", name: "Free Shipping", code: "FREESHIPBD")
p.promotion_actions << Spree::Promotion::Actions::CreateAdjustment.create()
pa = p.promotion_actions.first
pa.calculator = Spree::Calculator::FreeShipping.new
@justinstander
Copy link

unknown attribute 'event_name' for Spree::Promotion

@justinstander
Copy link

Gotta use Spree::PromotionBuilder

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment