I have this line at the top of my code:
if Input.cart.discount_code&.code == "CYBER2023" && !Input.cart.discount_code&.rejected?
However, if the code is rejected (like it has a minimum of $100 and the cart is $50), it rejects the code but applies everything that comes after the if statement above.
So, I have 2 questions:
- How can I make scripts not work if the code is not applied? (In production it simply passes that the code is not rejected even if it is)
- If that’s not possible, how do I implement features like the discount only being used once per customer?