How can I access WooCommerce ‘variations_form’ elements via JavaScript that are generated by a script template type?


I’ve recently customized the WooCommerce variable.php file for a single product to add a custom form text field, supposed to be filled in by buyers on each single product page. I have however failed to access this form field with getElementById(‘element_id’) or jQuery’s selector $(‘element_id’).

Though the ‘variations_form’ is visible via the browser inspector, it’s actually generated by a JavaScript template type once viewed in the source code.

How can I access the form elements within the variations_form?


kpatrickos 2 years 2020-10-22T15:10:34-05:00 0 Answers 14 views 0

Leave an answer