gform_stripe_field_value

Description

This filter can be used to modify a value before it is sent to Stripe. If you want to filter the value for any add-on you can use gform_addon_field_value.

Usage

The base filter which would run for all forms and all fields would be used like so:

add_filter( 'gform_stripe_field_value', 'your_function_name', 10, 5 );

To target a specific form append the form id to the hook name. (format: gform_stripe_field_value_FORMID)

add_filter( 'gform_stripe_field_value_10', 'your_function_name', 10, 4 );

To target a specific field append both the form id and the field id to the hook name. (format: gform_stripe_field_value_FORMID_FIELDID)

add_filter( 'gform_stripe_field_value_10_3', 'your_function_name', 10, 4 );

Parameters

  • $value string

    The value to be modified.

  • $form Form Object

    The Form currently being processed.

  • $entry Entry Object

    The Entry currently being processed.

  • $field_id string

    The ID of the Field currently being processed.

  • $meta_key string

    The custom meta key currently being processed. Since version 2.1.1.

Examples

1. Change value of specific custom meta key

add_filter( 'gform_stripe_field_value', function ( $field_value, $form, $entry, $field_id, $meta_key ) {
if ( $meta_key == 'my custom key' ) {
$field_value = 'my custom value';
}

return $field_value;
}, 10, 5 );

Placement

This code should be placed in the functions.php file of your active theme.

Since

This filter was added in Gravity Forms 1.9.10.11.

Source Code

This filter is located in GFStripe::maybe_override_field_value() in class-gf-stripe.php.