Grant points to the referrer based on a fixed percentage of the amount spent by his/her friend. (points & rewards plugin)

READ FIRST: This code needs to be added at the end of the functions.php file. If you are familiar with editing functions.php, feel free to continue reading. If you haven't done this before, adding this code in wrong place might bring the site down and the only way to access it is by editing functions.php file again via FTP. Feel free to contact us if you need help!

If you are using WooCommerce Points & Rewards plugin, and you want to grant points to the referrer based on a fixed percentage of the amount spent by his/her friend, add this code to your function.php file and change 0.01 which is 1% to the amount you want. In the example below if a friend buys something worth 100$, a user will receive 1$ worth of points. 

add_filter( 'gens_raf_points_amount', 'change_points_amount', 10, 2);
function change_points_amount($points,$order){
  $points = intval($order->get_total() * 0.01);
  return $points;
}
add_filter( 'gens_raf_generate_coupon', '__return_false' );

Still need help? Contact Us Contact Us