@brettfranklin2 Actually, I didn’t understand the code that much and where the prices come from. but as I see there are two buttons. so maybe you need to separate them. the ‘apply’ button would check the discount code and the ‘place’ button would store what you want in database.
what I want to ask, what is working so far and what is not? is the cal() function makes what you want ?