gform_product_field_types

Description

Filters the input types to use when checking if a field is a product field, allowing support for custom product fields.

Usage

add_filter( 'gform_product_field_types', 'your_function_name' );

Parameters

  • $product_fields array

    An array of the product field types.

    The default product types are:

        array(
    	'option',
    	'quantity',
    	'product',
    	'total',
    	'shipping',
    	'calculation',
    	'price',
    	'hiddenproduct',
    	'singleproduct',
    	'singleshipping'
    	)
        

Examples

add_filter( 'gform_product_field_types', 'set_product_types' );
function set_product_types( $product_types ){
	if ( ! in_array('my_custom_product', $product_types)){
		$product_types[] = 'my_custom_product';
	}

	return $product_types;
}

Placement

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

Since

This filter was added in Gravity Forms 1.9.14.

Source Code

This filter is located in GFCommon::is_product_field() in common.php.