• Resolved rezvanjalilian66

    (@rezvanjalilian66)


    hi

    I hope this email finds you well.

    I’m writing to request assistance with adding an affiliate link and copy button to WooCommerce product pages.

    I would like to display the affiliate link of the person who created the product profile alongside a copy button so that visitors can easily copy the link and share it with others.

    I’ve searched for solutions online, but I’m not sure how to implement this feature effectively. I would appreciate it if you could provide me with some guidance on how to achieve this.

    Thank you for your time and consideration.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author iova.mihai

    (@iovamihai)

    Hey @rezvanjalilian66,

    Thank you for reaching out! Can you please offer a bit more information about this: “the affiliate link of the person who created the product profile”?

    I’m not sure I understand how the product and the person are linked together, so if you can offer more details, I may be able to offer you assistance.

    Thank you and best wishes,

    Mihai

    Thread Starter rezvanjalilian66

    (@rezvanjalilian66)

    Thank you for your response.
    I want the affiliate link with the copy button that’s in the user profile.
    After adding to Cart, be placed on the product page

    The link is like this https://site.com/aff/1

    With or without a copy button

    Just a link to the site with an affiliate ID.

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @rezvanjalilian66,

    Thank you for the extra details! Unfortunately, I still don’t understand which affiliate’s referral link should be displayed on the product page.

    Do you want to make it easy for your affiliates to copy their own referral links for the product that’s been viewed?

    For example, if a non-affiliate is viewing one of your products, no field is shown. However, if a logged-in affiliate is viewing the product, a text field with their referral link should be shown. For example, for affiliate with ID 21, the text field would show something like: https://yoursite.com/product-name/aff/21/

    Is this what you’re looking for?

    Thank you and best wishes,

    Mihai

    Thread Starter rezvanjalilian66

    (@rezvanjalilian66)

    I want the original affiliate link to be shown.
    That way.
    Link to the site + ID

    site.com/aff/1

    Plugin Author iova.mihai

    (@iovamihai)

    Hey @rezvanjalilian66,

    I’m not really sure what you mean by “original affiliate”. When you install SliceWP, there aren’t any affiliates, so technically speaking, there isn’t an “original” affiliate. If you’re referring to affiliate with ID #1, then you can use this code snippet:

    function slicewp_custom_add_to_cart_affiliate_referral_link() {
    	
    	$affiliate_id = 1;
    	
    	if ( ! function_exists( 'slicewp_get_affiliate_url' ) ) {
    		return;
    	}
    	
    	$referal_link = slicewp_get_affiliate_url( $affiliate_id );
    
    	echo '<input type="text" style="display: block; width: 100%; margin-top: 10px;" value="' . esc_url( $referal_link ) . '"/>';
    	
    }
    add_action( 'woocommerce_after_add_to_cart_button', 'slicewp_custom_add_to_cart_affiliate_referral_link', 99 );

    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/).

    Thank you and best wishes,

    Mihai

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Adding an affiliate link and copy button to WooCommerce product pages’ is closed to new replies.