gform_mollie_payment_description

gform_mollie_payment_description

DescriptionUsageParametersExamples1. Remove the entry ID2. Include a field valuePlacementSinceSource Code

Description
Allow for the filtering of the payment description.
Usage
add_filter( 'gform_mollie_payment_description', 'your_function_name', 10, 5 );

Parameters

$description string
The payment description.
$description = 'Entry ID: 123, Products: Product A, Product B, Product C';

$strings array
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',
);

$entry array
The entry object currently being processed.

$submission_data Submission Data
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.

$feed array
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 should be placed in the functions.php file of your active theme.
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.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注