Created
November 2, 2016 16:58
-
-
Save dylanjhunt/6046d7f20dc262a01a9c7b663e641765 to your computer and use it in GitHub Desktop.
This will give a $5 discount on any product that has the tag identified in this Gist with MyTag
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
Input.cart.line_items.each do |line_item| | |
product = line_item.variant.product | |
next if product.gift_card? | |
next unless product.tags.include?('MyTag') | |
line_item.change_line_price(line_item.line_price - Money.new(cents: 500), message: "$5 Off") | |
end | |
Output.cart = Input.cart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment