New: Revenue First Analytics. See which channels actually drive your WooCommerce revenue. Learn more →

Contact Form 7 invites

Last updated

The built-in Share via email button sends a fixed message. If you want customers to write their own message, use a Contact Form 7 form. Refer a Friend adds a [gens_raf] form tag that puts the customer’s referral link into the email.

Before you start: install Contact Form 7. The form only includes a referral link for logged-in customers, so put it on a page that requires login, or on the My Account page.

1. Create the form

  1. Go to Contact → Add New.
  2. On the Form tab, add fields for the friend’s email and a message, and the [gens_raf] tag:
<label>Your friend's email [email* friend-email]</label>
<label>Your message [textarea your-message]</label>
[gens_raf]
[submit "Send invite"]

The [gens_raf] tag adds a hidden field with the customer’s referral link. Customers don’t see it.

2. Set up the email

On the Mail tab:

  1. Set To to [friend-email].
  2. Write a subject, for example “A gift from a friend”.
  3. Put [gens_raf] in Message body where the link should appear:
[your-message]

Use my link to get a discount on your first order:
[gens_raf]
  1. Save the form.

3. Add the form to a page

Copy the form’s shortcode, for example [contact-form-7 id="123" title="Invite a friend"], into the page. Add a sentence above it explaining the reward.

This form sends email from your store to any address a customer types. Use Contact Form 7’s spam protection, such as reCAPTCHA or Akismet, so it can’t be used to send spam.

Check it worked

Log in as a customer, send the form to your own address, and click the link in the email. The URL should end in ?raf= followed by the customer’s code.

Related

Browse our plugins

Lightweight WooCommerce plugins built for speed. No bloat, no frameworks -- just clean code that works.

View all plugins
Stay in the loop

Get notified when we launch new plugins. No spam, just product updates.