Site icon Hip-Hop Website Design and Development

Dynamically populate parameter in Gravity Forms using PHP

I have a global form I want to implement on our Product Catalogue, the product catalogue is written entirely in php (not a plugin) and it has a category and product filter. When you click on a product it goes to a more information page.

I have successfully embedded a Gravity Form on the product page so when you click on any product this form will show at the bottom.

I have set up a dynamic parameter called "populate_product".

The want to be able to use this to take the product title and auto-fill the field. I have basically no php knowledge and my attempts so far have just caused errors.

The php for the product page uses the following line of code to display the product title.

<h1 class='product-title'><?= $product['Title'] ?></h1>

How would I get this function to… function..as it should? I have been suggested to add a filter (below) but I don’t know exactly how to configure it given my lack of knowledge in coding.

add_filter( 'gform_field_value_your_parameter', 'my_custom_population_function' ); 
function my_custom_population_function( $value ) {
return 'boom!';
}