Skip to content

Instantly share code, notes, and snippets.

@kmeister2000
Created November 9, 2018 18:52
Show Gist options
  • Save kmeister2000/10b06fe23bb28da54f8baf9fbb18fd2e to your computer and use it in GitHub Desktop.
Save kmeister2000/10b06fe23bb28da54f8baf9fbb18fd2e to your computer and use it in GitHub Desktop.
Apply 30% discount to each item when purchasing 3 or more
return unless Input.cart.line_items.count < 3
Input.cart.line_items.each do |item|
item.change_line_price(item.line_price * .7, "Quantity discount applied!")
end
Output.cart = Input.cart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment