Skip to content

Instantly share code, notes, and snippets.

@danielbitzer
Created May 29, 2018 01:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielbitzer/d84a648cd83020dc8b04636154344219 to your computer and use it in GitHub Desktop.
Save danielbitzer/d84a648cd83020dc8b04636154344219 to your computer and use it in GitHub Desktop.
[Refer A Friend] Team based referrals, such as for Teams for WooCommerce Memberships
<?php
add_filter( 'automatewoo/referrals/advocate_id', 'my_filter_automatewoo_advocate_id_for_team_leader' );
/**
* @param $user_id
* @return int
*/
function my_filter_automatewoo_advocate_id_for_team_leader( $user_id ) {
// check if the user is a member of a membership team and not the owner
// if they are, then return the user ID of the team leader and then
// all team members will be sharing on behalf of their team
// referrals and store credit will be owned by the team leader
// INSERT TEAM LEADER LOGIC HERE
return $user_id;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment