1. Home
  2. Knowledge Base
  3. WooCommerce Product Add-Ons Ultimate
  4. Auto-populate field value
  1. Home
  2. Knowledge Base
  3. Product Page
  4. Auto-populate field value

Auto-populate field value

You can pre-populate a field value, e.g. through a parameter in the URL, by using the pewc_default_field_value filter.

* Filter the default field value using a value from a parameter in the URL
function prefix_default_field_value( $value, $id, $item, $posted ) {
if( isset( $_GET['my_param'] ) ) {
$value = $_GET['my_param'];
return $value;
add_filter( 'pewc_default_field_value', 'prefix_default_field_value', 10, 4 );

You can see how to add a snippet here.

Was this article helpful?

Need More Support?

If you can't find the answer that you're looking for, then please use the link below to raise a support ticket.
Contact Support

Related Articles