Answer the question
In order to leave comments, you need to log in
Are there plugins for creating referral links?
Are there any plugins similar to Order Master? Found only in quotations manually it is necessary to hand over links.
If anyone knows you need a solution that creates a personal account and creates a referral link itself
Answer the question
In order to leave comments, you need to log in
There are enough
options . In general, this is done quite simply by hand
1. Register get variable ref
add_filter( 'query_vars', 'add_query_vars' );
function add_query_vars( $qvars ) {
$qvars[] = 'ref';
return $qvars;
}
https://example.ru/?ref=48
function set_new_cookie() {
if ( $ref = get_query_var( 'ref', false ) ) {
//setting your cookies there
}
}
add_action( 'init', 'set_new_cookie' );
add_action( 'user_register', 'referral_registration_save', 10, 1 );
function referral_registration_save( $user_id ) {
if ( isset( $_COOKIE['ref'] ) )
add_user_meta( $user_id, 'ref', $_COOKIE['ref'], true );
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question