Prepopulate input field
-
I created a custom input field on a single woocommerce product page. The value of custom input field is saved into cart item data. Thats the code I put into functions.php:
add_action( 'woocommerce_before_variations_form', 'product_add_on', 9 ); function product_add_on() { global $product; if ( 12345 === $product->get_id() ) { $value = isset( $_POST['custom_text_add_on'] ) ? sanitize_text_field( $_POST['custom_text_add_on'] ) : ''; echo '<div><label><span>Your Name <abbr class="required" title="required">*</abbr></span></label><p><input name="custom_text_add_on" value="' . $value . '"></p></div>'; } }
Now I want to prepopulate this field with a Query-String. I want to send individual links to customers by E-mail which include already the value of this field. Something like https://www.website.com/linktoproduct?customername=XYZ
Can anybody of you experts help me with this?
Thanks and regards!`
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Prepopulate input field’ is closed to new replies.