On a Magento shopping cart, there are 2 forms that need to be filled out: shipping estimate and coupon code. Each refreshes the page after submitting the form. The shipping estimate form needs to be submitted before the coupon form so that the coupon can validate the country.
What I'd like to do is to call the shipping form's coShippingMethodForm.submit()
on load. That way the country is loaded, and then the coupon form will check the country. This has the added advantage that the initial shipping rates are displayed without requiring the user to submit the form.
My challenge: if I call coShippingMethodForm.submit()
on load - it will refresh the page and then continuously refresh b/c the coShippingMethodForm.submit()
keeps submitting and refreshing.
How do I call that function once, page refreshes, and not run again (unless the user clicks the submit button).