Skip to content

gfic_show_prices

Description

This PHP filter can be used to programmatically toggle the display of prices on Image Choices for Product and Option fields.

Usage

Applies to all fields.

add_filter( 'gfic_show_prices', 'toggle_image_choices_prices', 10, 4 );

Applies to all fields in a specific form. In this case, form id 5.

add_filter( 'gfic_show_prices_5', 'toggle_image_choices_prices', 10, 4 );

Applies to specific field and form. In this case, field id 3 in form id 5.

add_filter( 'gfic_show_prices_5_3', 'toggle_image_choices_prices', 10, 4 );

Parameters

  • $value boolean
    Whether price display is enabled or not.
  • $form_id integer
    The current form id.
  • $field_id integer
    The current field id.
  • $default_value string
    The plugin’s default value for this option.

Examples

This example disables the display of prices on Image Choices for Product fields

add_filter( 'gfic_show_prices', 'toggle_image_choices_prices', 10, 4 );
function toggle_image_choices_prices($value, $form_id, $field_id, $default_value) {
    $field = RGFormsModel::get_field( $form_id, $field_id );
    if ( $field->type == "product" ) {
        return false;
    }
    return $value;
}

Placement

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

Source Code

This filter is located in the get_field_settings_value function in class-gf-image-choices.php