Created
February 4, 2017 05:36
-
-
Save seedcms/10e88e7667b2d78f5e061aa0f0fb7aee to your computer and use it in GitHub Desktop.
Multiple Levels 1
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| | |
customer = Input.cart.customer | |
product = line_item.variant.product | |
if product.tags.include?('discount') | |
if customer.tags.include?("Industry") | |
line_item.change_line_price(line_item.line_price * 0.40, message: "Industry Customer") | |
elsif customer.tags.include?("Pro") | |
line_item.change_line_price(line_item.line_price * 0.50, message: "Pro Customer") | |
elsif customer.tags.include?("Tier2") | |
line_item.change_line_price(line_item.line_price * 0.70, message: "Tier2 Customer") | |
elsif customer.tags.include?("Tier3") | |
line_item.change_line_price(line_item.line_price * 0.50, message: "Tier3 Customer") | |
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