Skip to content

Customizing form field content based on URL query parameters like utm_source #6121

Discussion options

You must be logged in to vote

Hey @bsabalaskey

GiveWP recently released a Fields API for dynamically adding fields to the donation forms. With that, you can hook into different template locations within the form and register a new custom field - GiveWP will take care of the rest.

See give/src/Framework/FieldsAPI/ for supported field types.
See give'src/Form/LegacyConsumer/TemplateHooks.php for supported form template locations.

// Add field(s) before payment gateways
add_action( 'give_fields_payment_mode_before_gateways', function( $collection ) {

    // Append a required text field with the name myTextField
    $collection->append(
        give_field( 'text', 'myTextField' )
            ->label( 'My Text Field' )
  …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by kjohnson
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants