Skip to content

Instantly share code, notes, and snippets.

@WhiteHatJoker
Last active October 18, 2021 22:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WhiteHatJoker/ca6b8ede86a2d7085459aee896c66b11 to your computer and use it in GitHub Desktop.
Save WhiteHatJoker/ca6b8ede86a2d7085459aee896c66b11 to your computer and use it in GitHub Desktop.
Insert the survey form to woocommerce thank you/order confirmation page

Showing a survey form on a thank you page

Insert the survey form to woocommerce thank you/order confirmation page

Installation

  1. Install the Formidable Forms plugin and create new form based on your needs and preferences. I had personally created the form that has fields such as name, email, subject(automatically filled with the post title), questions and hidden product page url (also automatically generated). All this info is setup to be sent to the admin email when the form is submitted by the user.
  2. Copy over the code from current repository to your functions.php replacing the following: in bracketsecho FrmFormsController::show_form(28, $key = 'frmprocontact2', $title=false, $description=true); as follows: (Your created Formidable Form ID, $key= 'Formidable Form Key', $title = true or false depending on wheter or not you would like to display the title set in form, $description = true or false depeneding on whether or not you would like to display description from the form).
  3. Note: You can completely customize the look of the form by adding your own classes to the div surrounding the form. Also, if you would like to display the survey form lower on the thank you page you could change the value 1 in add_action ('woocommerce_thankyou', 'myfunction', 1); to something bigger and check the result.
/*Survey form on order received page*/
add_action ('woocommerce_thankyou', 'myfunction', 1);
function myfunction($order_id) {
echo '<div class="avada-choose-cause woocommerce-content-box full-width"><h2 data-fontsize="18" data-lineheight="27">Choose a Cause</h2>';
echo FrmFormsController::show_form(28, $key = 'frmprocontact2', $title=false, $description=true);
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment