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 the 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 our Points and Rewards plugin, you can disable generating of coupons and add points earning instead by using the code below. Change amount of points per your needs.
// Add points instead of referral coupon
add_action('gens_before_generate_user_coupon', function ($user_id, $type, $order) {
$points = 200;
// Add points
do_action(
'wpgens_loyalty_update_points',
$user_id,
$points,
WPGL_Points_Activity_Type::EARN,
WPGL_Points_Source_Type::REFER_FRIEND,
$order ? $order->get_id() : null,
'Referral reward'
);
}, 10, 3);
// Prevent coupon generation
add_filter('gens_raf_generate_coupon', function ($generate, $order_id) {
return false;
}, 10, 2);