We used the code below as a reference to reject discount codes if a specific item matched a certain criteria. What we'd like to do is use a code but exclude individual items from it if they have a specific tag. I know that you can put criteria on the discount codes themselves, be we have apps that generate unique codes to perform case by case discounts, so that wouldn't work here. From what I can tell, "discount_code.reject" rejects the code from the whole cart. Is this correct? Is there a way to exclude only specific line items from a discount code's application in a cart? CART_REJECTION_MESSAGE = "Cannot Use Discount Code on Sale Items"
condition_is_met = false
if Input.cart.discount_code != nil
Input.cart.line_items.each do |line_item|
product = line_item.properties
condition_is_met = true
Output.cart = Input.cart
... View more