Embed a Promo Code in Order Form

I am looking to embed a promo code into an order form so that it is already applied. Below is the code I found and am using.

When I first load the order form the promo code is in the box but the button hasn’t been clicked. The Dev console shows the following error. Infusion.Ecomm.OrderForms.ajaxSubmitForm is not a function

When I reload the page the promo code is applied.

Is there a way to make this work on first load? Thanks

Hi Chad, I can’t think of a way of doing that, other than what you already have, sorry.

But!

Could you not instead apply a product specific discount to that particular item (you might have to have 2 versions of the product if you don’t want it on all forms) and then apply that automatically via the criteria?

Andy