Setting up referrals
Set up a referral program in three parts: create referral codes, add an automatic reward rule, and add a Referral Code block to your cart, checkout or Thank you page.
Referrals take three parts: a code, an automatic reward rule and a Referral Code block. It works like this:
A shopper enters a code in your cart, at checkout, or on the Thank you page after ordering.
Stork Credit tags the customer with that code, for example
referral:SUMMER25. This happens once the order is placed, or straight away on the Thank you page.Your reward rule sees the tag and issues store credit for the order. For a code entered on the Thank you page after the order is already paid, the rule runs again so the order is still rewarded.
This works for guest checkouts as well as logged-in customers.
Part 1: Set up referral codes
Create one code for each influencer or partner.
Open Stork Credit and click Referral codes in the app menu.
Under New code, fill in the fields below.
Click Create code.
Code
What shoppers type in the Referral Code block, for example SUMMER25. It isn't case-sensitive and can't be changed later
Label
Optional. A note for you, such as the influencer's name
Success message
Shown in the Referral Code block when the code is accepted. Defaults to Code Successfully Applied
Each code gets a customer tag, shown in Your codes, for example referral:SUMMER25. The reward rule in Part 2 looks for this tag.
Edit changes a code's label or success message.
Disable stops the code being accepted without deleting it.
Delete removes the code permanently.
Part 2: Create the automatic reward
A code on its own issues nothing. The reward comes from an order-value automation that only applies to customers carrying the code's tag. The reward is store credit on the customer's account, not a discount at checkout.
On the Referral codes page, pick one of two shortcuts:
Create reward rule
Next to a code
Reward one code differently, for example a bigger reward for one influencer's audience
Create reward rule for all codes
Beside Your codes
Use one rule for every code, matching any tag that starts with referral:
Either button opens a new order-value rule with these settings already filled in:
Customer eligibility: Customers with specific tags, set to the code's tag.
Uses per customer: Once per customer.
Credit type: Fixed amount.
Then finish the rule:
Enter the reward Amount, or switch Credit type to a percentage of the order.
Set anything else you need, such as a minimum order value or an expiry for the credit.
Save the rule, then activate it.
An inactive rule credits nobody. Make sure the rule is active before you share your codes.
You can also start from the Referral reward template under Automations.
Part 3: Add the Referral Code block
Shoppers need somewhere to enter a code. There are three places to add a Referral Code block. Use any of them, or all of them:
Theme block: for your cart page or anywhere else in your theme. Works on every Shopify plan.
Thank you page block: for the page shoppers see after ordering. Works on every Shopify plan.
Checkout block: for your checkout. Needs a store on Shopify Plus.
The quickest way to add the theme and checkout blocks is from the app. On the Referral codes page, under Add the Referral Code block, click Add to theme or Add to checkout. Each button opens the right Shopify editor in a new tab. Add to checkout only appears on stores on Shopify Plus.
In your cart (any Shopify plan)
On the Referral codes page, click Add to theme. The theme editor opens on your Cart page with the Referral Code block already added.
Optional: drag the block to where you want it, and change the heading, button text, messages and colours in the block's settings.
Click Save.
To add the block to a different page, or to add it by hand:
In Shopify admin, go to Online Store → Themes and click Customize.
Open your Cart page, or whichever page you want it on.
Click Add block → Apps → Referral Code.
Click Save.
Adding it with HTML and Liquid instead
If you can't add the block in the theme editor, paste the code below into your theme instead. This helps if:
Apps doesn't appear under Add block on your cart page. This is common on older themes.
You want the code field in a cart drawer or pop-up cart.
You want to match your theme's design exactly.
The code works the same way as the block. It checks the code with Stork Credit, shows your success message, and saves the code on the cart so it reaches the order.
To add it to your theme files:
In Shopify admin, go to Online Store → Themes. Click ⋯ → Duplicate to make a backup first.
On your live theme, click ⋯ → Edit code.
Under Snippets, click Add a new snippet. Name it
stork-referraland click Done.Paste the code below into the new snippet and click Save.
Open the file for your cart and paste this line where the code field should appear:
File names vary by theme. On Dawn and other Shopify themes, the cart page is
sections/main-cart-footer.liquidand the cart drawer issnippets/cart-drawer.liquid.Click Save, then check your cart on the live store.
To change the wording, edit the text in the code. That includes the heading, the placeholder, the button labels and the messages. The success message comes from the code's own Success message in Stork Credit. The code field inherits your theme's fonts and button styles. You can restyle it with the stork-referral classes in the <style> section.
Leave two parts of the code as they are. 'Referral code' is the name the code is saved under, and Stork Credit looks for that exact name on the order. /apps/stork-credit/proxy/referral is where the code is checked. If either one changes, codes won't reach your orders and no one is credited.
Theme updates can replace edited files. After you update your theme, check the code field is still in your cart.
On the Thank you page (any Shopify plan)
In Shopify admin, go to Settings → Checkout and click Customize.
From the page menu at the top of the editor, choose Thank you.
Click Add app block and choose Referral Code.
Place it where shoppers will see it, for example near the top of the page.
Click Save.
The block asks Have a referral code? and shows a code field with an Apply button. When a code is accepted, shoppers see your success message and the store credit their order earned. If the order isn't paid yet, they see what they'll earn once it is. Codes can be entered for 24 hours after the order is placed, and can't be removed once applied.
In your checkout (Shopify Plus)
On the Referral codes page, click Add to checkout. You can also get there from Shopify admin: go to Settings → Checkout and click Customize.
Click Add app block and choose Referral Code.
Place it where shoppers will see it, for example near the order summary.
Optional: add the Automatic Store Credit block the same way.
Click Save.
Referral Code
A code field and an Apply button. When the code is accepted, they see your success message, the code and a Remove link
Automatic Store Credit
The store credit this order will earn. It updates as soon as a code is applied or removed, so shoppers see their reward before paying
A code accepted in the cart or checkout block is saved on the order, and shows under Additional details on the order as Referral code. A code entered on the Thank you page is added to the customer's tags instead, because the order has already been placed.
For more on the blocks, see Cart & checkout widgets.
Test it
Place a test order with a code. The customer is tagged after the order is placed, not when the code is applied.
If something's missing, check these:
Invalid referral code
The code exists, is active, and your store is on a paid plan
Referral code already applied
The customer already has a referral tag. The first code wins
No Referral code on the order
A Referral Code block was added and saved in the theme editor or checkout editor. The checkout block needs Shopify Plus. Codes entered on the Thank you page never appear on the order. Check the customer's tags instead
Code on the order but no tag
The code was disabled before the order was placed, or the order has no customer
Tag but no credit
The rule is active and its tag matches. Check the reason in the rule's Runs tab. See Run history
For how codes behave in detail, such as guests, first-code-wins and removing tags, see Referral codes.
Last updated