Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Analytics › URL Generator
- This topic has 1 reply, 2 voices, and was last updated 4 years, 7 months ago by WCFM Forum.
Viewing 1 reply thread
- AuthorPosts
- March 22, 2020 at 2:19 am #112586alexandermartineznmParticipant
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.
- April 3, 2020 at 9:24 am #114969WCFM ForumMember
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(' <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
- AuthorPosts
Viewing 1 reply thread
- You must be logged in to reply to this topic.