Enabling referral discount codes
To let your affiliates track sales using a discount code, navigate to "Groups" and click on the group you want to enable a referral code for. Next, hit "Edit referral rule" - this will take you to Shopify's built-in discount code page.
NOTE: Due to Shopify limitations, it's not possible to save a discount code rule with $0 or 0% off
Setting the rule
It is important to note that (1) the discount rule you set will apply to the entire group (2) affiliate commission is calculated after all discounts are applied. Since this is the built-in Shopify discount feature, you have full flexibility over your rule. You can use "Buy X get Y", "One use per customer", "Specific collections", or just have a flat "% / $ off" on all orders. Once you are done, hit save.
Confirming your settings
You will now see that the "referral code rule is active". If you want to change it, you can do so any time - any change will automatically update any affiliate's discount codes who are members of that group
You will also see that the group now shows "Active". This there is a referral code rule active, and members can use discount codes assigned to them to track referrals.