Referral codes at checkout

Besides sharing a link, advocates can tell friends their referral code, such as ref1234567. The friend types it in the coupon field at checkout. They get the friend discount, and the advocate gets the credit, exactly as with a link.

Codes are useful when advocates recommend you in person, on the phone or on social media where links are awkward. They also work when the friend switches device.

Turn on referral codes

Codes need three settings:

  1. Settings → General Settings → Enable Referral Codes is on.
  2. Settings → Friend Reward → First Purchase Discount is on.
  3. Settings → Friend Reward → Coupon Code contains a published WooCommerce coupon. See Friend reward settings.

Click Save after each change.

How it works

When the friend types a ref… code, the plugin creates a temporary coupon with that name. It copies the discount from your friend coupon:

  • Discount type and amount.
  • Products and categories, included and excluded.
  • Minimum spend, individual use, sale item exclusion and free shipping.

It doesn’t copy usage limits, allowed emails or the expiry date.

The plugin then saves the code in the referral cookie, so the advocate is credited when the order reaches the reward status.

Referral codes never appear under Marketing → Coupons. That’s expected: they only exist at checkout.

When a code is rejected

The friend sees WooCommerce’s message Coupon “ref1234567” does not exist! when:

  • One of the three settings above is off or empty, or the coupon in Coupon Code was deleted or moved to draft.
  • The code doesn’t belong to anyone. Check the code under Advocates.
  • The code is the customer’s own code.
  • The advocate is on the Emails to Ban list.
  • The friend discount is already in the cart, for example because the friend also used a link.

The code can also be accepted and then removed at checkout, with a message that the friend is an existing customer. See Referral discount removed at checkout.

Customize the coupon developers create

Developers can change the temporary coupon with the gens_raf_coupon_data filter. See Developers: hooks and filters.

Check it worked

  1. Copy an advocate’s code from Advocates.
  2. In a private window, add a product to the cart, open the cart and enter the code in the coupon field.
  3. The discount should apply.
  4. Place the order. Its Refer a Friend Data box should name the advocate.

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.