Last updated
Use shortcodes to show the referral section anywhere on your site, for example on a landing page that explains your program. Add them in a Shortcode block in the WordPress editor, or in a page builder’s shortcode element.
The shortcodes
| Shortcode | Shows | Visitors who aren’t logged in see |
|---|---|---|
[WOO_GENS_RAF] |
The referral link as plain text. | Nothing |
[WOO_GENS_RAF_ADVANCE] |
The referral section: rewards box, link, code, share buttons and share by email. | guest_text, or the guest form if guest referrals are on |
[WOO_GENS_RAF_FULL] |
Everything in My Account → Refer a Friend, including unused coupons and referral stats. | guest_text, or the guest form if guest referrals are on |
Most stores need [WOO_GENS_RAF_ADVANCE] on a landing page.
Attributes
| Attribute | Works with | What it does | Example |
|---|---|---|---|
url |
All three | The page the referral link opens. Overrides Referral landing page. | url="https://example.com/shop/" |
guest_text |
ADVANCE, FULL | What visitors who aren’t logged in see. HTML is allowed. | guest_text="Log in to get your link." |
two_columns |
ADVANCE, FULL | Shows the section in two columns on wide pages. | two_columns="true" |
Examples
A landing page that sends friends to the shop:
[WOO_GENS_RAF_ADVANCE url="https://example.com/shop/" guest_text='Please <a href="/my-account/">log in</a> to get your referral link.']
Use single quotes around guest_text when it contains HTML with double quotes.
Only the plain link, for example inside your own text:
Your referral link: [WOO_GENS_RAF]
Build a referral landing page
- Create a page, for example Refer a Friend.
- Explain the program: what the advocate gets, what the friend gets, and how to share.
- Add
[WOO_GENS_RAF_ADVANCE]below the explanation. - Link to the page from your menu, footer or emails.
When to use the full shortcode
Some themes and account page builders don’t show WooCommerce’s account tabs, so the Refer a Friend tab is missing. Add [WOO_GENS_RAF_FULL] to your custom account page instead. If you also want to remove the original tab, see Customize the My Account tab.
Check it worked
Open the page while logged in as a customer. You should see their own link, with ?raf= and their code. Then open it in a private window and check the guest text.