Referral Discounts for WooCommerce (RDFW)
A comprehensive referral discount system for WooCommerce. Allow customers to share referral codes and earn discounts.
by Ahmed Magdy · github.com/bassiouny2/referral-discounts-for-woocommerce-rdfw · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/bassiouny2/referral-discounts-for-woocommerce-rdfw/archive/refs/heads/main.zipReferral Discounts for WooCommerce
A powerful referral marketing plugin for WooCommerce that rewards both referrers and their friends with customizable discounts.
📋 Table of Contents
- Features
- Requirements
- Installation
- Configuration
- Usage
- Shortcodes
- Hooks & Filters
- FAQ
- Changelog
- Support
- License
✨ Features
Core Features
- Dual Reward System - Configure separate discounts for referrers and friends
- Flexible Discount Types - Support for percentage and fixed amount discounts
- Unique Referral Codes - Auto-generated unique codes for each customer
- Shareable Referral Links - One-click copyable links with customizable redirect
Social Integration
- Social Sharing Buttons - WhatsApp, Facebook, Messenger, X (Twitter), LinkedIn, Telegram, Email
- Customizable Share Message - Configure the message shared on social platforms
- Admin Control - Enable/disable individual social platforms
Analytics & Reporting
- Analytics Dashboard - Visual overview of referral performance
- Top Referrers - Track your best performing advocates
- Monthly Performance - Historical data with visual charts
- Real-time Activity Feed - Monitor recent referral activity
Email System
- WooCommerce Email Styling - Emails match your store's design
- Customizable Templates - Full control over email content
- Template Variables - Dynamic content with placeholders
- Multiple Email Types - Invitation, referral used, reward notification
Customization
- Text Settings - Customize all frontend labels and messages
- Display Options - Show code only, link only, or both
- Referral Link Expiry - Enable/disable with custom duration
- Category Restrictions - Limit discounts to specific categories
Security & Anti-Abuse
- Self-Referral Prevention - Users cannot use their own codes
- Usage Limits - Control how many times a friend can use referrals
- First Order Only - Option to restrict to first-time customers
- Nonce Verification - Secure form submissions
📦 Requirements
| Requirement | Minimum Version |
|---|---|
| WordPress | 6.0+ |
| WooCommerce | 7.0+ |
| PHP | 7.4+ |
| MySQL | 5.6+ |
🚀 Installation
From WordPress Admin
- Navigate to Plugins → Add New
- Search for "Referral Discounts for WooCommerce"
- Click Install Now then Activate
- Go to Settings → Permalinks and click Save Changes
Manual Installation
- Download the plugin zip file
- Extract to
/wp-content/plugins/referral-discounts-for-woocommerce/ - Activate through Plugins menu in WordPress
- Go to Settings → Permalinks and click Save Changes
Via Composer
composer require developer/referral-discounts-for-woocommerce
Important: After activation, always visit Settings → Permalinks and click Save Changes to flush rewrite rules.
⚙️ Configuration
Accessing Settings
Navigate to WooCommerce → Referral Discounts in your WordPress admin.
Settings Tabs
1. Analytics
Overview of your referral program performance:
- Total referrers, friends, orders, and discounts
- Top performing referrers
- Recent activity feed
- Monthly performance chart
2. General Settings
| Setting | Description |
|---|---|
| Enable Plugin | Turn the referral system on/off |
| Display Mode | Show code only, link only, or both |
| Invite by Email | Enable/disable email invitation form |
| Redirect Page | Where to redirect after clicking referral link |
| Link Expiry | Enable expiration and set duration (days) |
Friend Discount Settings:
- Enable/disable friend discount
- Discount type (fixed/percentage)
- Discount value
Referrer Discount Settings:
- Enable/disable referrer reward
- Discount type (fixed/percentage)
- Discount value
Restrictions:
- First order only
- Minimum order amount
- Exclude sale items
- Eligible categories
- Usage limit per friend
Social Sharing:
- Enable/disable individual platforms
- Customize share message
3. Text Settings
Customize all frontend text including:
- Page titles and labels
- Button text
- Discount messages
- Checkout field labels
4. Referrers
Manage all referrers:
- View referral codes
- See referred friends count
- Track total orders and discounts
- Set per-referrer discount overrides
5. Friends
Manage referred customers:
- Search by email
- View referrer information
- Set per-friend discount overrides
- Reset usage count
6. Email Settings
Configure email notifications:
- Enable/disable emails
- Set from name and address
- Use WooCommerce email template
- Customize email templates
📖 Usage
For Store Owners
-
Configure Discounts
- Set friend discount (e.g., 10% off first order)
- Set referrer reward (e.g., $5 coupon per referral)
-
Customize Experience
- Choose display mode (code, link, or both)
- Enable social sharing platforms
- Set up email notifications
-
Monitor Performance
- Check Analytics dashboard regularly
- Identify top referrers
- Track conversion rates
For Customers
-
Find Your Code
- Go to My Account → Referral Program
- Copy your unique referral code or link
-
Share with Friends
- Use social sharing buttons
- Send email invitations
- Share the link directly
-
Earn Rewards
- When friends make purchases using your code
- Receive reward coupons via email
For Referred Friends
-
Use Referral Code
- Click the referral link, or
- Enter code at checkout
-
Get Discount
- Discount applies automatically
- See savings in cart/checkout
🔧 Hooks & Filters
Actions
// After referral is recorded
do_action( 'rdfw_referral_recorded', $referrer_id, $friend_id, $order_id );
// After reward coupon is created
do_action( 'rdfw_reward_coupon_created', $coupon_id, $referrer_id );
// Before sending invitation email
do_action( 'rdfw_before_send_invitation', $referrer_id, $friend_email );
Filters
// Modify referral code format
add_filter( 'rdfw_generate_referral_code', function( $code, $user_id ) {
return 'REF-' . $code;
}, 10, 2 );
// Modify discount amount
add_filter( 'rdfw_friend_discount_amount', function( $amount, $friend_id ) {
return $amount;
}, 10, 2 );
// Modify referral link
add_filter( 'rdfw_referral_link', function( $link, $code ) {
return $link;
}, 10, 2 );
// Modify email variables
add_filter( 'rdfw_email_variables', function( $vars, $type ) {
$vars['{custom_var}'] = 'Custom Value';
return $vars;
}, 10, 2 );
❓ FAQ
General Questions
Q: Does this plugin require WooCommerce? A: Yes, WooCommerce 7.0 or higher must be installed and activated.
Q: Can I use different discounts for referrers and friends? A: Yes! You can configure completely separate discount settings for each.
Q: How do customers find their referral code? A: In the "Referral Program" section of their My Account page.
Q: Can I disable the referrer reward? A: Yes, you can disable either the friend discount or referrer reward independently.
Technical Questions
Q: Why do I get a 404 error on the referral page? A: Go to Settings → Permalinks and click Save Changes to flush rewrite rules.
Q: Is the plugin compatible with caching plugins? A: Yes, but you may need to exclude the My Account page from caching.
Q: Does it work with WPML/Polylang? A: Yes, the plugin is translation-ready and works with multilingual plugins.
Q: Is it GDPR compliant? A: The plugin only stores necessary data for functionality. No data is sent to external servers.
📝 Changelog
Version 1.4.2
- Critical Fix: Fixed fatal error in Logs & Coupons tab (missing
get_coupon_statusmethod) - Critical Fix: Fixed "Invalid maximum spend value" error when creating reward coupons
- Added: Maximum Spend setting for reward coupons (maximum order total allowed when using coupon)
- Fixed: Translation loading warnings by properly loading textdomain on
inithook - Improved: Separated maximum spend (order total limit) from maximum discount (discount cap for percentage)
- Improved: Maximum discount for percentage coupons now stored in meta data only
Version 1.4.1
- Bug Fix: Fixed issue where reward coupons were not being created when minimum spend was set
- Improved Logging: Enhanced error handling and detailed logging for coupon creation process
- Better Debugging: Added comprehensive logging to track all coupon settings during creation
Version 1.4.0
- Maximum Discount Value: New setting to limit the maximum discount amount when using percentage discounts for both friends and referrers
- Reward Coupon Minimum Spend: New setting to require a minimum order amount before reward coupons can be used
- Maximum discount fields automatically show/hide based on discount type (only visible for percentage discounts)
- Improved discount calculation to respect maximum discount limits
Version 1.3.0
- Coupon Tab Integration: Reward coupons now automatically appear in My Account coupons tab, compatible with WooCommerce Smart Coupons and other coupon plugins
- "How to Use" Tab: New admin dashboard tab with comprehensive guide on using the plugin
- Enhanced error handling to prevent critical errors during order status changes
- Improved reward coupon display in My Account
Version 1.2.0
- Order Number Restriction: Control which order number referral codes can be used on (1st, 2nd, 3rd, or any order)
- Reward Coupon System: Referrers receive WooCommerce coupons as rewards when friends make purchases
- Reward Trigger Status: Choose when to grant rewards (pending, processing, or completed order status)
- Reward Coupon Display: New section in My Account showing all reward coupons with status
- Checkout Integration: Referral codes now use the standard WooCommerce coupon field
- Order Total Tracking: Track total order value from referral orders for analytics
Version 1.1.0
- Analytics Dashboard: Comprehensive analytics with statistics, top referrers, and monthly performance
- Text Customization: Full control over all frontend text labels and messages
- Social Media Sharing: Integration with WhatsApp, Facebook, Messenger, Twitter, LinkedIn, and Telegram
- Display Modes: Option to show referral link only, code only, or both
- Referral Link Redirect: Option to select redirect page (Homepage, Shop, or custom page)
- Link Expiry: Configurable expiration for referral links
- Improved Admin UI/UX: Better organized admin dashboard with card-based layouts
Version 1.0.0 (Initial Release)
- Dual reward system for referrers and friends
- Social sharing integration (7 platforms)
- Analytics dashboard with performance metrics
- Email notifications with WooCommerce styling
- My Account integration
- Checkout referral code field
- Customizable text settings
- Referral link expiration options
- Category-based restrictions
- Anti-abuse protection
🆘 Support
Documentation
Full documentation is available in the documentation folder.
Getting Help
- Check the FAQ section above
- Review the documentation
- Contact support at support@example.com
Reporting Bugs
Please report bugs via the support forum or email with:
- WordPress version
- WooCommerce version
- PHP version
- Steps to reproduce
- Expected vs actual behavior
📄 License
This plugin is licensed under the GPL v2 or later.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
🙏 Credits
- Built for WooCommerce
- Icons by Dashicons
- Developed following WordPress Coding Standards
Made with ❤️ for WooCommerce store owners