I've got some .js running so that if the customer chooses the country Canada, I swap out the STATE field for a select field.
PROBLEM -- recently my order forms started to load with a button to either click to pay with Credit Card, or click the PayPal button... and this is making my scripts not load/not work because the fields they are looking for are now not being loaded with the DOM - they get loaded when someone clicks that button.
Infusion.Ecomm.OrderForms.selectPaymentType('creditcard');Infusion.Ecomm.OrderForms.ajaxSubmitForm('orderForm', false, 0, '', 'AN-Monthly-Recurring', 'RENDER_ORDER_FORM',
['ORDER_FORM_BILLING_ENTRY', 'PAYMENT_SELECTION', 'ORDER_FORM_SHIPPING_ENTRY', 'SHIPPING_OPTIONS', 'CHECKOUT_LINKS'])
Is there anyway to disable this behavior, and have my order form just load without the choices? For example, if I click "Credit Card," then reload the form, the entire form loads, and my scripts work.
I want the entire form to load each time.
What is a callback / what can I hook a function on to so that it will wait until after the button is clicked, and all the forms load?
Or does someone already have a .js snippet to just hide this button/paypal thing, and unhide the form ... since I see it's all there, and my script has already worked, but once the "Pay with Credit Card" button is clicked, I think the billing fields get reloaded, and my script is now moot.