• Resolved bacco4249

    (@bacco4249)


    It’s possible to auto generate the referral link in a custom field when the affiliate is logged and visits the product, so he just copy the link and share it, instead of copy the link from the url bar an go to his affiliate dashboard to convert the url in a referral url?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • I have the same question

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @bacco4249 and @obmerlo,

    Thank you for reaching out! This currently cannot be done out of the box, however, it can be done via a custom shortcode.

    Firstly, please add the following code snippet to your website:

    function slicewp_custom_shortcode_affiliate_url_input_field() {
    
        if ( is_admin() ) {
            return;
        }
    
        if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
            return;
        }
    	
    	$output = '';
    
        if ( is_user_logged_in() && slicewp_is_affiliate_active( slicewp_get_current_affiliate_id() ) ) {
    		
    		$referal_link = slicewp_get_affiliate_url( slicewp_get_current_affiliate_id(), get_permalink() );
    		$output 	  = '<input type="text" style="display: block; width: 100%; margin-top: 10px;" value="' . esc_url( $referal_link ) . '"/>';
    		
    	}
    
        return $output;
    
    }
    add_shortcode( 'slicewp_custom_shortcode_affiliate_url_input_field', 'slicewp_custom_shortcode_affiliate_url_input_field' );

    Please copy the code and add it to your website. If you’re not sure how to add code snippets to your site, you can use the Code Snippets plugin (https://www.ads-software.com/plugins/code-snippets/).

    Then, add the [slicewp_custom_shortcode_affiliate_url_input_field] shortcode to your website, where you want to output the field with the affiliate’s referral link.

    If a non-affiliate user is viewing the page, nothing will be outputted.

    Thank you and best wishes,

    Mihai

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Auto generate referral links’ is closed to new replies.