• Hi there, I need to add the following code to my products pages. I didn’t know how to add it through the code so I added it to the bottom of each products description window. However I need this added to the code below the actual description window, because at the moment when I fill in the form and press submit it opens my redirected window inside the description table. Instead if it was placed underneath the description table (not inside it) I guess it would redirect me correctly.

    Please can you help me how to hard code it into products page without losing it when the plugin is updated? (like between description and related products please)

    Thank you

    <h2 style=”text-align: center;”><span style=”color: #bd0000;”>What would you like to do now?</span></h2>
    <p style=”text-align: center;”>[gravityform id=”17″ title=”false” description=”true” ajax=”true”]</p>

Viewing 3 replies - 1 through 3 (of 3 total)
  • See woocommerce/templates/content-single-product.php for the arrangement and order of elements on the product page. Your theme may have an override.

    Try this, sorry not tested.

    <?php
    add_action( 'woocommerce_after_single_product_summary', 'my_custom_code', 12);
    function my_custom_code() {
      print '<h2 style="text-align: center;"><span style="color: #bd0000;">What would you like to do now?</span></h2>'.PHP_EOL;
      print '<p style="text-align: center;">';
      print do_shortcode ('[gravityform id="17" title="false" description="true" ajax="true"]');
      print '</p>'.PHP_EOL;
    }
    

    The code goes in functions.php for your child theme or you can use the “My Custom Functions” plugin. Either will be update-safe.

    Thread Starter fiona92

    (@fiona92)

    Thank you, I’ve tried adding it through my child theme function.php but doesn’t show anything when I reload the page. Anything else I could try please?

    I tried it now and it works for me on my theme. Well, the title shows but the shortcode just shows as text because I don’t have that plugin.

    What theme are you using? If its a wordpress.org theme I’ll try the code with that.

    Please copy and paste the entire contents of your child theme’s functions.php into here:
    http://phpcodechecker.com/
    Click Analyse. Does it come up error free?

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Woocommerce product page -adding gravity form’ is closed to new replies.