Discount Script runs on first discount code applied

If I apply a discount code X that triggers a script to run and then add a code Y, the script will think X is the code applied and will run the script, resulting in both X and Y being applied. It does not run twice, once per code, it runs once and only sees the code that was replaced. Also, Editor is not equal to Production. It works correctly in the editor but not in production. I also see that in the cookies it states both discounts as applied. I have no other scripts created. No code can combine.

What can I do to prevent that? I’ve tried everything I could think of.

Additional info: Can’t use functions because I can’t target specific line items in it and I need the discount to not display on subscription items. I have no checkout.liquid.