Using Gravity Forms ‘gform_freshbooks_send_item_id_for_fixed_dynamic’ PHP filter

The gform_freshbooks_send_item_id_for_fixed_dynamic is a Gravity Forms PHP filter that enables sending the Item ID instead of the Item Name when using the Fixed Costs or Dynamic Field Mapping settings.

Usage

add_filter('gform_freshbooks_send_item_id_for_fixed_dynamic', '__return_true');

Parameters

This filter has no parameters.

More information

See Gravity Forms Docs: gform_freshbooks_send_item_id_for_fixed_dynamic

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

Examples

Enable sending Item ID for Fixed Costs

Enable the sending of the Item ID instead of the Item Name when using the Fixed Costs setting.

add_filter('gform_freshbooks_send_item_id_for_fixed_dynamic', '__return_true');

Enable sending Item ID for Dynamic Field Mapping

Enable the sending of the Item ID instead of the Item Name when using the Dynamic Field Mapping setting.

add_filter('gform_freshbooks_send_item_id_for_fixed_dynamic', '__return_true');

Conditionally enable sending Item ID

Conditionally enable sending the Item ID based on the form ID.

function custom_gform_freshbooks_send_item_id($enable_item_id) {
    $form_id = 1; // your form ID
    if (rgar(GFFormsModel::$posted_form, 'id') == $form_id) {
        return true;
    }
    return $enable_item_id;
}
add_filter('gform_freshbooks_send_item_id_for_fixed_dynamic', 'custom_gform_freshbooks_send_item_id');

Enable sending Item ID for specific form

Enable sending the Item ID for a specific form by checking the form ID.

function enable_item_id_for_specific_form($enable_item_id) {
    $target_form_id = 3;
    if (rgar(GFFormsModel::$posted_form, 'id') == $target_form_id) {
        return true;
    }
    return $enable_item_id;
}
add_filter('gform_freshbooks_send_item_id_for_fixed_dynamic', 'enable_item_id_for_specific_form');

Disable sending Item ID for specific form

Disable sending the Item ID for a specific form by checking the form ID.

function disable_item_id_for_specific_form($enable_item_id) {
    $target_form_id = 4;
    if (rgar(GFFormsModel::$posted_form, 'id') == $target_form_id) {
        return false;
    }
    return $enable_item_id;
}
add_filter('gform_freshbooks_send_item_id_for_fixed_dynamic', 'disable_item_id_for_specific_form');