This plugin gives you the ability to grant an affiliate bonus upon a new referral. If you are using Affiliates, Affiliates Pro or Affiliates Enterprise plugins from itthinx.com, you can give an extra token to your affiliates. Apart from the commission you have chosen, you can grant a bonus. Furthermore, you can also choose the amount and the currency.
How it Works
When a new referral is recorded, the plugin checks the affiliate’s referral stats. If the number of referrals matches the number of referrals we choose, then the affiliate gets a bonus as well. Basically, if the conditions are met, another referral named “Initial Referral Bonus, will be recorded for the given affiliate.
In the use case i’ve implemented, the affiliate bonus is granted upon first referral. So, when one of your affiliates gets his first referral, he gets another bonus of 10 USD.
If you have already set the referral status under Affiliates > Settings > Referrals, the bonus referral status will be set accordingly. Otherwise the bonus status, will be Pending.
Let’s have a look at the snippet.
The Snippet
Copy and paste the following in your functions.php file of your child theme.
add_action( 'affiliates_referral', 'affiliates_referral_initial_bonus', 10, 2 ); function affiliates_referral_initial_bonus( $referral_id, $params ) { $description = "Initial Referral Bonus"; $rate = 0.12; $currency_id = get_option( 'woocommerce_currency' ); $aff_default_referral_status = get_option( 'aff_default_referral_status' ) ? get_option( 'aff_default_referral_status' ) : "pending"; $type = "initial bonus"; $reference = ""; $aff_id = $params['affiliate_id']; $total_referrals = affiliates_get_affiliate_referrals( $aff_id, $from_date = null , $thru_date = null, $status = $aff_default_referral_status, $precise = false ); if ( $total_referrals == 1 || $total_referrals == '1' ) { $amount = bcmul( $rate, $params['base_amount'], 2 ); affiliates_add_referral( $aff_id, null, $description, null, $amount, $currency_id, $status = null, $type = null, $reference = null ); } else { return; } }
Affiliate bonus – Updates & Suggestions
If you want to implement a different use case, you are welcome to ask here and i will be happy to assist you. 🙂
For suggestions or new features, you can also fork the GitHub repository.
Razak says
Hi, I just install your plugin..but how to setup the plugin..what setting need to be done…Do advise please.
Thanks
George says
Hi Razak,
I will modify the plugin and reply to you back to the support forum.
Thanks for using the plugin 🙂