I was able to make a custom shortcode using this:
<?php
if (!defined('ABSPATH')) {
exit;
}
$user_id = get_current_user_id();
$user = new WP_User($user_id);
$referral_url_by_userid = 'id' === $settings['referal_link'] ? true : false;
$referral_url = add_query_arg($referral->referral_handel, $user->ID, wc_get_page_permalink('myaccount'));
if ($referral_url_by_userid) {
$referral_url = add_query_arg($referral->referral_handel, $user->ID, wc_get_page_permalink('myaccount'));
}
?>
<span>
<?php _e('Your referral URL is:', 'woo-wallet'); ?>
<input type="text" readonly="" id="referral_url" value="<?php echo $referral_url; ?>" />
<div class="referral-tooltip">
<button onclick="referralTooltip()" onmouseout="referralTooltipOutFunc()">
<span class="referral-tooltiptext" id="referral_tooltip"><?php _e('Copy to clipboard', 'woo-wallet'); ?></span>
<?php _e('Copy', 'woo-wallet'); ?>
</button>
</div>
</span>
But the displayed link is
https://mywebsite.com/my-account/?=1
but it should be
https://mywebsite.com/my-account/?wwref=1
It is missing wwref=
What did i do wrong here?
Thanks
-
This reply was modified 3 years, 9 months ago by Najm.
-
This reply was modified 3 years, 9 months ago by Najm.