Using Gravity Forms ‘gform_stripe_discounted_line_items_name’ PHP filter

The gform_stripe_discounted_line_items_name filter allows you to customize the line item name when there are coupon discounts applied to the payment in Gravity Forms.

Usage

add_filter('gform_stripe_discounted_line_items_name', 'custom_discounted_line_items_name', 10, 5);

function custom_discounted_line_items_name($name, $feed, $submission_data, $form, $entry) {
    // your custom code here
    return $name;
}

Parameters

  • $name (string): The line item name of the discounted order.
  • $feed (array): The feed object currently being processed.
  • $submission_data (array): The customer and transaction data.
  • $form (array): The form object currently being processed.
  • $entry (array): The entry object currently being processed.

More information

See Gravity Forms Docs: gform_stripe_discounted_line_items_name

Examples

Customize the line item name for discounted payments

Change the line item name for discounted payments to “Discounted Payment”:

add_filter('gform_stripe_discounted_line_items_name', 'change_discounted_line_items_name', 10, 5);

function change_discounted_line_items_name($name, $feed, $submission_data, $form, $entry) {
    $name = "Discounted Payment";
    return $name;
}

Add a custom prefix to the line item name

Add a custom prefix to the line item name for discounted payments:

add_filter('gform_stripe_discounted_line_items_name', 'add_prefix_to_line_items_name', 10, 5);

function add_prefix_to_line_items_name($name, $feed, $submission_data, $form, $entry) {
    $prefix = "Special Offer - ";
    $name = $prefix . $name;
    return $name;
}

Add a custom suffix to the line item name

Add a custom suffix to the line item name for discounted payments:

add_filter('gform_stripe_discounted_line_items_name', 'add_suffix_to_line_items_name', 10, 5);

function add_suffix_to_line_items_name($name, $feed, $submission_data, $form, $entry) {
    $suffix = " - Limited Time!";
    $name = $name . $suffix;
    return $name;
}

Customize the line item name based on the form ID

Change the line item name based on the form ID for discounted payments:

add_filter('gform_stripe_discounted_line_items_name', 'customize_line_items_name_by_form_id', 10, 5);

function customize_line_items_name_by_form_id($name, $feed, $submission_data, $form, $entry) {
    if ($form['id'] == 1) {
        $name = "Discounted Payment - Form 1";
    } elseif ($form['id'] == 2) {
        $name = "Discounted Payment - Form 2";
    }
    return $name;
}

Customize the line item name based on a form field value

Change the line item name based on a form field value for discounted payments:

add_filter('gform_stripe_discounted_line_items_name', 'customize_line_items_name_by_field_value', 10, 5);

function customize_line_items_name_by_field_value($name,