Description
Allow for the filtering of the payment description.
Usage
add_filter( 'gform_mollie_payment_description', 'your_function_name', 10, 5 );
Parameters
The payment description.
$description = 'Entry ID: 123, Products: Product A, Product B, Product C';
Contains the Entry ID and Products. The array which was imploded to create the description.
$strings = array(
'entry_id' => 'Entry ID: 123',
'products' => 'Products: Product A, Product B, Product C',
);
The entry object currently being processed.
Contains the form title, payment amount, setup fee amount, trial amount, line items created using the submitted pricing field values and any discounts from coupons.
The feed object currently being processed.
Examples
1. Remove the entry ID
The following example shows how you can remove the entry ID from the description.
add_filter( 'gform_mollie_payment_description', 'remove_entry_id', 10, 2 );
function remove_entry_id( $description, $strings ) {
unset( $strings['entry_id'] );
return implode( ', ', $strings );
}
2. Include a field value
The following example shows how you can append the value of a form field to the description.
add_filter( 'gform_mollie_payment_description', 'append_field_value', 10, 3 );
function append_field_value( $description, $strings, $entry ) {
return $description . ', Name: ' . rgar( $entry, '1.3' ) . ' ' . rgar( $entry, '1.6' );
}
Placement
This code can be used in the functions.php file of the active theme, a custom functions plugin, a custom add-on, or with a code snippets plugin.
See also the PHP section in this article: Where Do I Put This Code?
Since
Added in Mollie 1.0
Source Code
apply_filters( 'gform_mollie_payment_description', $description, $strings, $entry, $submission_data, $feed );
This hook is located in GF_Mollie::get_payment_description() in class-gf-mollie.php.