Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'woocommerce_single_product_summary', function () {
- global $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; margin-bottom: 10px;">
- <i class="wcfmfa fa-link fa-xs" aria-hidden="true"></i>
- <span class="afcode" data-aurl="<?php echo $affiliate_url; ?>"><b>1% ortaqlı məhsul</b> <i style="color:#8802ff;cursor:pointer;" title="Sıxaraq Kopyala və Paylaş" class="fas fa-share-alt"></i></span>
- </div>
- <div class="wcfm-clearfix"></div>
- <script>
- jQuery(document).ready(function($) {
- $("span.afcode").on("click", function(e) {
- e.preventDefault();
- var $temp = $("<input>");
- $("body").append($temp);
- $temp.val($(this).data("aurl")).select();
- document.execCommand("copy");
- $temp.remove();
- alert("Product affiliate url copied!");
- });
- });
- </script>
- <?php
- }
- }
- }, 6 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement