gform_product_total

gform_product_total

DescriptionUsageParametersExamples1. Add a value to the total2. Prevent totals less than zeroSource Code

Description
Fires right before updating the Total value for forms with pricing fields. Allows users to implement custom logic to manipulate the Total value.
NOTE: This filter only applies to the form front end javascript, and will only change the display of the Total. You must also implement the gform_product_info to make sure the total is displayed properly in the entry pages and sent properly to third party services via Add-Ons such as the PayPal Add-On
The best location to put this javascript code is by adding an HTML field to your form and place the javascript code in that field, wrapped with the script tags.
An alternative placement is to put the javascript in the gform_pre_render hook.
Usage
gform.addFilter( 'gform_product_total', function(total, formId){
// do something with the total
return total;
} );

Parameters

total float
The total to be filtered.

formId integer
The ID of the form in use.

Examples
1. Add a value to the total
This example adds $50 to the total price if the quantity field is greater than 100

2. Prevent totals less than zero

Source Code
This filter is located in gravityforms.js

發表回覆

您的電子郵箱地址不會被公開。 必填項已用 * 標註