ontact Form 7 is one of the most popular free contact form plugins for WordPress and Mailchimp is an enormously powerful email marketing tool. There are quite a few guides on the internet telling you how to make the two work together. Unfortunately, most of them seem to overcomplicate things or use improper and unmaintainable code.
This post will show you how to add a Mailchimp sign-up checkbox to your Contact Form 7 form without writing a single line of code.
People who send you a message will be able to subscribe to your Mailchimp list(s) with ease. You can choose to have the checkbox pre-checked so it doesn't even require them to click.
- Contact Form 7
- Mailchimp for WordPress Pro or even the free version
- A Mailchimp account (referral link, we'll both get $30 in so-called MonkeyRewards if you use this link to sign-up to Mailchimp)
Adding the sign-up checkbox to your Contact Form 7 template
To add the newsletter sign-up checkbox to your contact form we can use a simple shortcode that comes with the Mailchimp for WordPress plugin when you have Contact Form 7 enabled.
[mc4wp_checkbox "Your custom label text, asking visitors to subscribe."]
As you can see, I added a custom label text but this is completely optional.
That's it. We're done. No additional code is required.
The plugin will automatically find the email address of the person filling out your contact form and add it to the selected list(s) in Mailchimp for WP > Checkboxes.
Sending more fields to Mailchimp
So your list has a required field which holds the
first name of every subscriber? No problem. Just prefix
the CF7 field name with
mc4wp- and the
plugin will send it to Mailchimp as a merge variable.
Example CF7 mark-up for FNAME
The part after the dash should match the "merge tag" of the list field.
Let's do another example but this time for a list
WEBSITE. This time, we'll be
using the Contact Form 7 "Generate Tag"
Easy, right? It's a sure way to get more subscribers to your email lists as well. Want to see a live example? I am using it for my own contact form on the plugin site.