Redirect Users After Submitting a Gravity Form

Gravity Forms is a great plugin with huge functionality that I use on almost all of my websites.  It just works and if there is ever a time when you cannot get it to do something that you want you can almost always find a solution through their support forums.

Recently I was trying to find a way to redirect my users to a specific url depending on which drop down they chose.  Once they submitted the form they would then be redirected to a certain url.  I used this to create a way for users to choose a purchase item in Gravity Forms and then they would be directed to a Woocommerce page within my site to actually pay for that item.

So, how did I accomplish this?  After doing some searching around the web (http://www.gravityhelp.com/forums/topic/conditional-redirect-2#post-80796) I took the directions from several sites and came up with the following snippet that works well.

Add this to your functions.php file.

 

The things you need to change:

  • On line 6 – Change “gform_confirmation_3” to the correct form ID number.  So all you are really changing here is the number “3” to your form number.
  • On Line 12 – Change “Name of Drop Down 1” to the EXACT name of your drop down select item.
  • On Line 13 – Change the url for “http://www.google.com” to the url you want to redirect the user.

That’s it![/fusion_builder_column][/fusion_builder_row][/fusion_builder_container]

By |January 11th, 2015|Wordpress|4 Comments

4 Comments

  1. Vladan April 17, 2015 at 3:40 pm - Reply

    You have one mistake, instead of:
    =>
    Please change to =>

  2. Patrick November 17, 2015 at 5:09 am - Reply

    Great snippet! Thank you so much! 🙂

    I was wondering though, how would I create a conditional redirect based on two drop down selections?
    So:

    If [select 1 = option 1] & [select 2 = option 1] then redirect to URL #1
    If [select 1 = option 2] & [select 2 = option 1] then redirect to URL #2
    If [select 1 = option 1] & [select 2 = option 2] then redirect to URL #3
    If [select 1 = option 1] & [select 2 = option 2] then redirect to URL #4

  3. SSSV April 26, 2016 at 1:11 pm - Reply

    Patrick, did you figure out how to do this? I am also looking for that solution…

    Thanks!
    Ssara

  4. Tony Journo December 5, 2016 at 3:22 pm - Reply

    @SSSV
    Yes Gravity Forms supports conditional confirmations out of the box. Go to the “Confirmations” page under “Form Settings”. At the top you’ll see a button to “Add New”. Click this to add a new confirmation. On the confirmation edit view at the very bottom will be a section labeled “Conditional Logic” (example). You can use this section to indicate when this confirmation should be used.

Leave A Comment