Last updated
Next to the social share buttons, advocates can invite friends by email directly from your site. They enter each friend’s email and name, and the plugin sends the RAF: Share with a Friend email with the advocate’s referral link.
How advocates use it
- In the referral section, under Share via Email, the advocate enters a Friend’s email and Friend’s name.
- They click + to add more friends, or – to remove a row.
- They click Send Emails.
Each friend gets a separate email. {{name}} in the email is the advocate’s name and {{friend_name}} is the name they typed. To change the text, edit RAF: Share with a Friend in WooCommerce → Settings → Emails. See Emails overview.
Sending limits
To stop the form being used for spam, version 4.4.12 limits sending:
| Limit | Value | Message the advocate sees |
|---|---|---|
| Friends per send | 15 | “You can send to a maximum of 15 recipients at once.” |
| Emails per hour, per visitor | 30 | “You have reached the email sending limit. Please try again later.” |
Developers can change them with the wpgens_raf_max_email_recipients, wpgens_raf_email_rate_limit and wpgens_raf_email_rate_window filters.
Hide the form
- Go to WooCommerce → Refer a Friend → Settings → Email Settings.
- Turn on Hide share via email option.
- Click Save.
The social share buttons stay. To choose which of those show, see Display settings.
See who was invited
Every invitation is recorded in WooCommerce → Refer a Friend → Event Logs.
To keep your own list of invited emails, for example to export it, use this snippet. Read Add code snippets safely first. Checked with version 4.4.12.
add_action( 'new_raf_data', function ( $type, $data ) {
if ( 'email_share' !== $type ) {
return;
}
$shared = get_option( 'raf_shared_emails', array() );
$shared[] = array(
'email' => $data['email'],
'name' => $data['name'],
'user_id' => $data['user'],
'date' => current_time( 'mysql' ),
);
update_option( 'raf_shared_emails', array_slice( $shared, -5000 ), false );
}, 10, 2 );
// [raf_shared_emails] shows the list to shop managers and admins only.
add_shortcode( 'raf_shared_emails', function () {
if ( ! current_user_can( 'manage_woocommerce' ) ) {
return '';
}
$output = '<ul>';
foreach ( get_option( 'raf_shared_emails', array() ) as $row ) {
$output .= '<li>' . esc_html( $row['email'] . ' (' . $row['name'] . ') - ' . $row['date'] ) . '</li>';
}
return $output . '</ul>';
} );
It keeps the latest 5,000 invitations. Put [raf_shared_emails] on a private page to see them.
Invited friends haven’t agreed to hear from you. Don’t add them to marketing lists without their consent.
Check it worked
Log in as a customer, open My Account → Refer a Friend, and send an invitation to an address you can check. The email should arrive with the customer’s referral link, and the invitation should appear in Event Logs.