The gform_mollie_payment_method_label filter allows you to modify the Payment Method label when creating a Mollie field in Gravity Forms.
Usage
To apply the filter to all forms:
add_filter('gform_mollie_payment_method_label', 'your_function_name', 10, 2);
To apply the filter to a specific form, e.g., form with ID 5:
add_filter('gform_mollie_payment_method_label_5', 'your_function_name', 10, 2);
Parameters
- $label (string): The label to be filtered.
- $form_id (int): The current form ID.
More information
See Gravity Forms Docs: gform_mollie_payment_method_label
Place this code in the functions.php file of your active theme.
Examples
Change Payment Method label for all forms
function change_payment_method_label($label, $form_id) { return "Select a Payment Method"; } add_filter('gform_mollie_payment_method_label', 'change_payment_method_label', 10, 2);
Change Payment Method label for a specific form
function change_payment_method_label_for_form_5($label, $form_id) { return "Choose Your Preferred Payment Option"; } add_filter('gform_mollie_payment_method_label_5', 'change_payment_method_label_for_form_5', 10, 2);
Append the form ID to the Payment Method label
function append_form_id_to_payment_method_label($label, $form_id) { return $label . " (Form ID: " . $form_id . ")"; } add_filter('gform_mollie_payment_method_label', 'append_form_id_to_payment_method_label', 10, 2);
Modify the Payment Method label based on the form ID
function modify_payment_method_label_based_on_form_id($label, $form_id) { if ($form_id == 5) { return "Special Payment Method"; } return $label; } add_filter('gform_mollie_payment_method_label', 'modify_payment_method_label_based_on_form_id', 10, 2);
Change the Payment Method label to uppercase
function uppercase_payment_method_label($label, $form_id) { return strtoupper($label); } add_filter('gform_mollie_payment_method_label', 'uppercase_payment_method_label', 10, 2);