bookmark_bordergform_order_summary

Description

Filter the markup of the order summary which appears on the Entry Detail, the {all_fields} merge tag and the {pricing_fields} merge tag.

Usage

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

add_filter( 'gform_order_summary', 'your_function_name', 10, 3 );

You can limit the scope of the filter to a single form by appending the form id on the end of the hook name like so:

add_filter( 'gform_order_summary_6', 'your_function_name', 10, 3 );

Parameters

  • $markup string

    The order summary markup.

  • $form

    The current form.

  • $entry Entry Object

    The current entry.

  • $order_summary array

    An array containing the products, options and shipping for the current entry.

  • $format string

    The format with which the markup should be formatted. Accepted values are ‘html’ or ‘text’.

Examples

1. Add a Row to the Order Summary Table Footer

Note that the markup differs slightly depending on the location the filter is called. When generated for the {all_fields} and {pricing_fields} merge tags, inline styles are included. When called from the Entry Detail view, inline styles are not included.

We recommend using GFCommon::is_entry_detail() to check if you are on the Entry Detail view. Otherwise, assume the generated markup is for one of the merge tags.

add_filter( 'gform_order_summary', 'allow_basic_tags' );
function allow_basic_tags( $allowable_tags ) {
    if( GFCommon::is_entry_detail() ) {
        $row = '
            <tr>
                <td>&nbsp;</td>
                <td>My Custom Option</td>
                <td>$10.00</td>
            </tr>';
    } else {
        $row = '
            <tr>
                <td>&nbsp;</td>
                <td style="border-bottom:1px solid #DFDFDF; border-right:1px solid #DFDFDF; padding:7px; text-align:right; width:155px; font-family: sans-serif;"><strong style="font-size:12px;">My Custom Option</strong></td>
                <td style="border-bottom:1px solid #DFDFDF; border-right:1px solid #DFDFDF; padding:7px; width:155px; font-family: sans-serif;"><strong style="font-size:12px;">$10.00</strong></td>
            </tr>';
    }

    $markup = str_replace( '<tfoot>', '<tfoot>' . $row, $markup );
}

Placement

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

Source Code

This filter is located in:

  • GFCommon::get_submitted_pricing_fields() in common.php
  • GFEntryDetail::lead_detail_grid() in entry_detail.php

Since

Add in Gravity Forms 2.1.2.5.