• Resolved amandathewebdev

    (@amandathewebdev)


    Hello all,

    I’m hoping someone can help me. I’ve looked on some woocommerce forums and gravityform forums and I don’t see a solution to this, which is a little bizarre because I think a lot of people could use this.

    I have a gravityform that I want to auto populate with the post/product title. I followed directions on here:
    https://www.gravityhelp.com/documentation/article/gform_field_value_parameter_name/
    https://www.gravityhelp.com/documentation/article/using-dynamic-population/

    On my gf field I checked: Allow field to be populated dynamically, but it’s not working. Here is the code I have:

    //Autopopulate Gravity form on product page
    add_filter( 'gform_field_value_product_info', 'my_custom_population_function' );
    function my_custom_population_function( $value ) {
        global $post;
    
        $product_title = get_the_title('ID', $post->post_title);
    
        return $product_title;
    }

    Could someone help me figure out why this doesn’t work? Am I missing a step?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I could do with the same thing but until someone comes up with an answer a work around if you add the form on to each page in the product description and add

    [gravityforms id=your_from_id field_values=’your Parameter name=your product name’]

    Hope that helps

    Thread Starter amandathewebdev

    (@amandathewebdev)

    Hi, I’m sorry, I forgot about this post. I figured out how to do this. I call the form normally in a shortcode with ajax set to true:
    [gravityform id="2" title="false" description="false" ajax="true"]

    And in the field settings, under the advanced tab, I have this:
    {embed_post:post_title}

    I hope that helps!

    Spot on thanks Amanda

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Dynamically populate Gravityform field with Woocommerce Product title’ is closed to new replies.