The gform_display_product_summary filter is used to control whether the pricing summary should be included in the output generated when using the {all_fields} merge tag. By default, the pricing summary is included.
Usage
A generic example of how to use the filter:
add_filter('gform_display_product_summary', 'your_function_name', 10, 4);
Parameters
- $display_product_summary (boolean): Determines if the pricing summary table should be included in the {all_fields} output. Default is true.
- $field (Field Object): The field currently being processed.
- $form (Form Object): The form currently being processed.
- $entry (Entry Object): The entry currently being processed.
More information
See Gravity Forms Docs: gform_display_product_summary
Examples
Disable for all forms
Disable the pricing summary table for all forms:
add_filter('gform_display_product_summary', '__return_false');
Disable for a specific form
Disable the pricing summary table for a specific form with form ID 10:
add_filter('gform_display_product_summary', function($display_product_summary, $field, $form, $entry) { return rgar($form, 'id') == 10 ? false : $display_product_summary; }, 10, 4);
Disable for specific fields
Disable the pricing summary table for specific fields with field IDs 3 and 5:
add_filter('gform_display_product_summary', function($display_product_summary, $field, $form, $entry) { return in_array($field->id, array(3, 5)) ? false : $display_product_summary; }, 10, 4);
Disable for specific form and specific fields
Disable the pricing summary table for a specific form with form ID 10 and specific fields with field IDs 3 and 5:
add_filter('gform_display_product_summary', function($display_product_summary, $field, $form, $entry) { return rgar($form, 'id') == 10 && in_array($field->id, array(3, 5)) ? false : $display_product_summary; }, 10, 4);
Enable only for specific form
Enable the pricing summary table only for a specific form with form ID 20:
add_filter('gform_display_product_summary', function($display_product_summary, $field, $form, $entry) { return rgar($form, 'id') == 20 ? true : $display_product_summary; }, 10, 4);