URL Generator

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Viewing 1 reply thread
  • Author
    Posts
    • #112586

      Hello you can put the URL Generator at the top <Head>on the product page.

      So we can generally generalthe affiliate link of that product easier

      Note URL Builder will only be enabled in the <head>for users with affiliate role.

      I’m waiting for this update, you can include it urgently please.

    • #114969
      WCFM Forum
      Member

      Hi,

      Add this code snippet to your site. This will show affiliate url under each single product page –

      add_action( 'woocommerce_single_product_summary', function() {
      	global $WCFM, $WCFMmp, $product;
      	if( wcfm_is_affiliate() ) {
      		if( method_exists( $product, 'get_id' ) ) {
      			$product_id = $product->get_id();
      			$affiliate_id = get_current_user_id();
      			$affiliate_url = wcfm_get_affiliate_url( $affiliate_id, get_permalink( $product_id ) );
      			
      			?>
      			<div class="wcfm-clearfix"></div>
      			<div class="store_info_parallal" style="margin-right: 10px;">
      				<i class="wcfmfa fa-link" aria-hidden="true"></i>
      				<span class="afcode" data-aurl="<?php echo $affiliate_url; ?>">Affiliate URL</span>
      			</div>
      			<div class="wcfm-clearfix"></div>
      			<script>
      				jQuery(document).ready(function($) {
      					$code_index = '999';
      					$('span.afcode').each(function() {
      						$(this).append('&nbsp;&nbsp;<i style="color:#00897b;cursor:pointer;" data-ref="'+$code_index+'" title="Copy" class="fa fa-copy"></i>');
      						$(this).append('<textarea style="border:0!important;height:0px;opacity:0!important" id="'+$code_index+'">'+$(this).data('aurl')+'</textarea>'); 
      						
      						
      					 $(this).find('i').click(function() {
      						var copyText = document.getElementById($(this).data('ref'));
      						copyText.select();
      						document.execCommand("copy");
      					 });
      					 $code_index++;
      					});
      				});
      			</script>
      			<?php
      		}
      	}
      }, 6 );

      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      Thank You

Viewing 1 reply thread
  • You must be logged in to reply to this topic.