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
- Go to Contact → Add New.
- 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:
- Set To to
[friend-email]. - Write a subject, for example “A gift from a friend”.
- 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]
- 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.