🎉  Build a workflow powerhouse. Learn more about our new Airtable integration.   🎉

June 24, 2015

Populate a PDF Receipt from a Formidable Order Form

Formidable is a popular Wordpress form plugin for creating contact forms, order forms, registration forms and many more types of web forms.  But what if you want to take that information collected on the form and populate a Word document or PDF?  Your options are very limited.  Unless you have WebMerge, of course!  With Formidable and WebMerge you can place forms on your website to collect data from your customers, then you can populate a PDF, Word document, PowerPoint presentation, and more.

In this example we’re going to show you how you can generate a PDF receipt from an order form that you’ve already built with Formidable.  We’ll then email this receipt directly to our customer for their records.  We could even save a copy in Dropbox for our records as well.

To get started, we’re going to build our document (template) in WebMerge using the online document builder.  Go to the Documents page and then click the New Document button.  Type in a name like “Order Receipt”, then on the next step pick the Build Your Own option.  Next, you’ll be directed to the document builder.

In the document builder we’re going to add our logo, address, and then setup the merge field tags for where we want the order information to go.  Merge tags are simple text that you can type right in the document like {$name}, {$email}, etc.  You can only use letters, numbers, and underscores (no special characters or spaces).  Here’s what our receipt template looks like:

When you’re finished building your template, move on to the next step and you can modify the settings of the document.  We’re going to skip over this and go straight to the Deliver tab so that we can setup email delivery to our customer.  By default, we’ve already created an email delivery that sends the PDF to you, so we’re just going to edit that email delivery.

Under the “To” you’re going to want to pick the email merge field you put in your document.  If you didn’t place an email field in your document, then pick <<other>> and type in something like {$email_to}.  This will create the merge field even though it isn’t in the actual receipt.  Feel free to edit any of the other email settings.

Great, we’re moving along nicely!  Let’s setup the integration with Formidable now.  To setup the integration between Formidable, we’re going to add a little bit of code to our Wordpress installation that will automatically send the form entries directly to WebMerge as they are submitted.

We’ve setup the code for you as a starting point.  Go ahead and copy & paste this code into your Theme’s main PHP file (or the customizer.php file in the “inc” folder):

In this code, the only thing you are going to need to modify is the first part where we are determining which WebMerge URL to use.  As you’ll see there are a few “if” statements there that you’ll need to modify based on your Form ID and then change the URL to the Merge URL for your document (which you can find under the Merge tab inside WebMerge).  This tells the system where to send the form data when a new entry comes in.

After we’ve added the code and saved our theme, we need to modify the form field “keys” so that they send over the correct name that corresponds with the merge fields we used in WebMerge.  For example, if we used “{$CustomerName}” in our template, we need to update the field key to be “CustomerName”.  You can find this setting when editing a field in the form builder:

Congrats, you’re all done and ready to test!  Go ahead and submit a new entry to your form and you should see the merge go to WebMerge.  Here’s what our populated receipt looks like:

Can you think of any other types of documents that you could streamline with Formidable + WebMerge?  Think about all the time you’re going to save!

Also, for all of you Zapier fans, you can also use Zapier to integrate Formidable and WebMerge.  With Zapier you can connect hundreds of web services to “talk” to each other without needing to write any code.  If you have not already installed the Formidable Zapier plugin yet, please go here first and follow the installation instructions.

6 min read

Ready to give Formstack Documents a try?
Start your Free Trial now!


Populate Documents from Formidable Now

By signing up here, you agree to our Terms of Use