Last active
April 29, 2024 13:32
-
-
Save danielbitzer/4c127037ee0b012fdf77e7989680563e to your computer and use it in GitHub Desktop.
AutomateWoo Refer A Friend - Make referral coupons use the user ID of the advocate instead of a random string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// In addition to adding this code you should set the Coupon Expiry setting to zero to disable coupon expiry | |
add_filter('automatewoo/referrals/generate_advocate_key', 'my_automatewoo_referrals_generate_advocate_key', 10, 2 ); | |
/** | |
* @param $key | |
* @param AW_Model_Referral_Advocate $advocate | |
* @return int|string | |
*/ | |
function my_automatewoo_referrals_generate_advocate_key( $key, $advocate ) { | |
return $advocate->get_id(); | |
} |
@blazz92 did you find the solution?
Best I could come up with at this time is 'REF[user_id][first_name]': https://gist.github.com/jrick1229/cfd87548c66406a2492576b05fd93579
Using only first name creates advocate issues, as they are indistinguishable.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi and thanks for sharing these codes.
Do you maybe have a solution to generate coupon with advocates first name and than id without the prefix?
Or is it possible to set first name instead of default "REF" prefix?
Blaž