Using Gravity Forms ‘gform_product_price’ PHP filter

The gform_product_price filter allows you to change the sub-label for the Product Price input in Gravity Forms.

Usage

A generic example of how to use the filter:

add_filter('gform_product_price', 'your_function_name', 10, 2);

To target a specific form, add the form ID after the hook name (format: gform_product_price_FORMID):

add_filter('gform_product_price_6', 'your_function_name', 10, 2);

Parameters

  • $sublabel (string) – The sub-label to be filtered.
  • $form_id (integer) – ID of the current form.

More information

See Gravity Forms Docs: gform_product_price

Examples

Change Price Sub-label to “Cost”

This example changes the price sub-label to “Cost” for form ID 185. Replace 185 with your form ID or remove _185 to apply the filter to all forms.

add_filter('gform_product_price_185', function($sublabel, $form_id) {
    GFCommon::log_debug(__METHOD__ . '(): Running...');
    return 'Cost';
}, 10, 2);

Note: The colon will be added automatically after the label.