Created
          February 4, 2017 05:45 
        
      - 
      
 - 
        
Save seedcms/f32baf732d32d58ed19a0018fa196c8d to your computer and use it in GitHub Desktop.  
    Coupon "Over"
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | money = Money.zero | |
| Input.cart.line_items.each do |line_item| | |
| money+=line_item.line_price | |
| end | |
| Input.cart.line_items.each do |line_item| | |
| puts money | |
| cart = Input.cart | |
| product = line_item.variant.product | |
| if cart.discount_code.code == "OVER" | |
| if product.id == 9284928268 && money >= Money.new(cents: 5000) | |
| line_item.change_line_price(line_item.line_price - Money.new(cents: 1000), message: "OVER") | |
| end | |
| end | |
| end | |
| Output.cart = Input.cart | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment