gform_format_option_label

gform_format_option_label

DescriptionUsageParametersExamplesRemove Price from LabelDisplay Price before LabelShow Option Price instead of Variable PricingPlacementSource Code

Description
This filter is executed when calculating and displaying the pricing on product option fields or shipping fields set as drop down field or radio buttons type. Use this filter to change the format of the choice labels for these field types.
Usage

Parameters

fullLabel string
The default label that will be displayed for the current option. It has the field choice label as well as the calculated price. (i.e. My Option +$5.00)

fieldLabel string
The field/option label without the price. (i.e. My Option)

priceLabel string
The price text without the field label. (i.e. +$5.00)

selectedPrice float
The price of the currently selected option.

price float
The price of this option. (The option that this label applies to)

formId integer
The current form ID.

fieldId integer
The current field ID.

Examples
Remove Price from Label
The following example disables the option pricing, displaying only the option label.

Display Price before Label
The following example changes the order of the labels, displaying the option price before the field label. I only does that for form ID 5.

Show Option Price instead of Variable Pricing
This example replaces the variable pricing with the static full option price for a field with id 43.

Placement
This code should be placed in an HTML field on your form or you may use the gform_pre_render hook to echo the script block to the page.
Source Code
This filter is located in gravityforms.js

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注